Groups | Blog | Home
all groups > asp.net webcontrols > july 2003 >

asp.net webcontrols : how to know all of index of selected item on web listbox control



haiwen
7/11/2003 12:26:37 PM
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,

Victor Garcia Aprea [MVP]
7/11/2003 9:49:08 PM
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.
[quoted text, click to view]

haiwen fu
7/14/2003 6:28:50 AM

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


*** Sent via Developersdex http://www.developersdex.com ***
haiwen
7/14/2003 6:44:45 AM
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

[quoted text, click to view]
AddThis Social Bookmark Button