|
hi, I'm trying to get multiple values that was selected in a dropdown list, the problem is that it's only returning one value, if I select two or more values only give me one, here's the code:
List<String> dep = new List<String>();
foreach (ListItem item in sltnamedep.Items)
{
if (item.Selected)
{
dep.Add(item.Text);
}
}
for (int i = 0; i < dep.Count; i++)
Response.Write(dep[i]);
|
|
|
|
|
is the MultiSelection is enabled for the listView? can you print/check the number of selected items using sltnamedep.Items.Count property
Jibesh V P
|
|
|
|
|
Make sure you have focus on the control.
MSDN says:
Quote: Items appear selected only when the ListView control has focus. To select items in response to a user action such as a button click, be sure to call the Focus method in addition to setting this property.
|
|
|
|