Hi Guys,
I have non-unique values in my ListBox control, so whenever I do something
like
if (myList.SelectedIndex == 2) I get wrong results, as it picks out the
wrong index. How can I ammend this problem, so that I get the selected index
,
i.e. the exact index selected.
Thanks,
I.AIrfan,
you can try to use the SelectedValue property if you know the value you have
to compare to. For example if you have a listbox with Red, Green, Blue:
if (myList.SelectedValue == "Red")
// [...]
Hope that helps!
Regards,
Michael
"Irfan Akram" <IrfanAkram@.discussions.microsoft.com> schrieb im Newsbeitrag
news:48A7AC0C-3FAA-4DC7-BD7E-D1EFCCE5B589@.microsoft.com...
> Hi Guys,
> I have non-unique values in my ListBox control, so whenever I do something
> like
> if (myList.SelectedIndex == 2) I get wrong results, as it picks out the
> wrong index. How can I ammend this problem, so that I get the selected
index,
> i.e. the exact index selected.
> Thanks,
> I.A
Thursday, March 22, 2012
ListBox control
Labels:
asp,
control,
guys,
listbox,
mylist,
net,
non-unique,
picks,
selectedindex,
somethinglikeif,
values,
whenever,
wrong
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment