Click here to Skip to main content
15,895,746 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Listbox1 as follows

Name
Ramesh
Suresh
Vignesh
Rajesh

i wan to store the above listbox1 items into Hiddenfield.

for that how can i do in asp.net using c#.

Regards
Narasiman P.
Posted

HI Narasiman

you can do like this
create a hidden field in the aspx page
and you can store the list items in comma separated string to the hidden field.

C#
for (int i = 0; i < ListBox1.Items.Count; i++)
               {
                   hdnfld.Value += ListBox1.Items[i].Text + ",";
               }
 
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