Click to See Complete Forum and Search --> : How to Save list box item in database


rajesh20k
November 16th, 2005, 07:26 AM
Hi,
I am writting an application in ASP.net using VB.net.I faced some problem.
I would like to save all item of list box in SQL Server.Item are added in list box on client side.I have a server side Save button .When I press the Save button on server side then i get there is no item in list box while listbox contains five items on client side.I would like to know that how to find all items in list box on client soide to store into database.

Thanks in advance


rajesh

HanneSThEGreaT
November 16th, 2005, 07:49 AM
I would like to know that how to find all items in list box on client soide to store into database.



For i = 0 To ListBox1.Items.Count - 1 'gets the number of items
If ListBox1.Items(i).Selected Then
'this will lop through the list box and check which items were selected
End If
Next

Is this what you mean ¿ :confused:

rajesh20k
November 16th, 2005, 11:29 PM
Hi HanneSThEGreaT
I have already tested this code


For i = 0 To ListBox1.Items.Count - 1 'gets the number of items
If ListBox1.Items(i).Selected Then
'this will lop through the list box and check which items were selected
End If
Next

But I get ListBox1.Items.Count is equal to 0 while listBox conatins five items on client side.Actually , I have used to JavaScript Function to add item in the list box. Items are added successfully in the list box.Now I would like to Display all items in list box on clicking server side Button . Problem is when i press Server Side Botton then automatically listbox is cleared. Please help me.