| Author: Prafulla S Shimpi 12 Sep 2008 | Member Level: Gold Points : 1 |
Can you please put complete code? This doesn't give clear idea about this code.
One thing you can try is use List box instead of Dropdown. This may help you.
Also, tell me are you using datareader object to fill the dropdown?
|
| Author: Raju.M 15 Sep 2008 | Member Level: Gold Points : 2 |
if u have a dropdownlist like DropDownList3. we can chege the SelectedIndex through code.
if (DropDownList3.Items.Count > 0) { for (int i = 0; i < DropDownList3.Items.Count; i++) { if (DropDownList3.Items[i].Text == "someType") { DropDownList3.Items[i].Selected == true; break; } } }
now we change this SelectedIndex to any other
if (DropDownList3.Items.Count > 0) { for (int i = 0; i < DropDownList3.Items.Count; i++) { if (DropDownList3.Items[i].Text == "Education") { DropDownList3.Items[i].Selected == true; break; } } }
it will produce an error "Multiple selection not allowed in DropDownList" to avoid this we cann write
if (DropDownList3.Items.Count > 0) { for (int i = 0; i < DropDownList3.Items.Count; i++) { if (DropDownList3.Items[i].Text == "Education") { DropDownList3.ClearSelection(); DropDownList3.Items[i].Selected == true; break; } } }
i think now u can get the clear picture.if u have more doubts reply me
|