selection index change is not working of drop down list [closed]
i have only one element in drop downlist so selection index change is not working... the datasource is given to run time... if it was on designing time i can give the select one list item... but at run time what should i do????????
if i've understood correctly your problem you can you add an empty item at design time , set the append databound item to true and selected property of the empty item to true
In your code when filling the list, check how many items there are, and if it is only one, manually call the method that the selected index changed event is hooked up to.
You want to call SelectedIndexChanged Event? I'm right?
If so, just do this:
private void callSelectedIndex()
{
ComboBox cb = new ComboBox(); // Some ComboBox control to pass.
comboBox1_SelectedIndexChanged(cb, null); // Your ComboBox's SelectedIndexChanged event method.
}
精彩评论