Retrieve Values from a ListBox

P

Patrick H

The ListBox class has a method (GetSelectedIndices) which returns an
array of integers which represent the index of items selected.

Info about that method here:
http://msdn2.microsoft.com/en-us/library/system.web.ui.webcontrols.listbox.getselectedindices.aspx

for example you can iterate through those items and get the values like
this:
string queryToAppend = null;
foreach( int i in listBoxName.GetSelectedIndices() )
{
string queryToAppend += listBoxName.Items.Value;
}


something of that nature.

-Patrick H
http://patpack.blogspot.com/
 

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

Top