how to know all of index of selected item on web listbox control

H

haiwen

Hi, everyone:

Is there some way to know all of the index number of all
selected item in a multi-selection list web control.

Sincerely,

haiwen
 
V

Victor Garcia Aprea [MVP]

Hi haiwen,

You need to iterate through the ListItemCollection collection, exposed by
the Items property and check the Selected property for each ListItem.

--
Victor Garcia Aprea
Microsoft MVP | ASP.NET
Looking for insights on ASP.NET? Read my blog:
http://obies.com/vga/blog.aspx

To contact me remove 'NOSPAM'. Please post all questions to the newsgroup

and not by private mail.
 
H

haiwen fu

hi, thanks for your reply, but it seems we can get all of the indexs by
the SelectedIndices[] of the listbox. for web form, even I iterate
through the listitem collection and get the selected item by checking
its selected property. this selected item doesn't have index property. I
can't find the way to get the index of these items even I know they are
selected on Web Form. could you give me some code.

Thank you so much

Haiwen
 
H

haiwen

Hi, Thank you for your reply,
But even after I iterate through the ListItem and get all
the selected items, it seems the item doesn't have any
property to know its index at the ListBox on Web Form. on
Window Form, we can get them by SelectedIndices[].

Could you give me some code to show how to do it.

Sincerely,

haiwen
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,767
Messages
2,569,572
Members
45,045
Latest member
DRCM

Latest Threads

Top