Click here to Skip to main content
15,886,258 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
removed dupelicate

i hava multiple value in this field
i need to inset the values to list

What I have tried:

C#
foreach (TreeNode node in TRVPersonnel.CheckedNodes)
{

	hftreenodevalue.Value += node.Value + ",";

   Session["idRole"] = hftreenodevalue.Value;
	list = Session["idRole"] as List<string>;

	foreach (var L in list)
	{
	}
}
Posted
Updated 25-Jul-17 18:27pm
v2
Comments
BillWoodruff 25-Jul-17 14:25pm    
You need to provide more detail, Is this WinForms ? What is 'Session ?
j snooze 25-Jul-17 17:38pm    
you also need to tell use what "this value" is. you have a session value, a list variable , and a hftreenodevalue.value field. It looks like you are already putting your values in a list. Unless you are trying to get the comma delimited values into a string list. I recommend doing a hftreenodevalue.Value.Split(",") that will at least put them in an array of strings. My thoughts, but then again I don't know that I fully understand what you are trying to accomplish.

1 solution

Since you are storing the data in comma separated format, you should split by comma to get the string array/list

string csv = Convert.ToString(Session["idRole"]);
           List<string> list = csv.Split(',').ToList();
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900