In C#, I created a string test = "test2"; and I wanted to get the index of the test2 from my asp:dropdownlist.
these are the items in my drop down list
test1
test2
test3
In C#, I created a string test = "test2"; and I wanted to get the index of the test2 from my asp:dropdownlist.
these are the items in my drop down list
test1
test2
test3
I'm not sure if you are lazy or not but hey maybe this is what you looking for:
string test = "test2";
int ps = yourdrplst.Items.IndexOf(yourdrplst.Items.FindByText(test));