Here’s the simple code:
protected void DropDownList1_SelectedIndexChanged1(object sender, EventArgs e)
{
string word = DropDownList1.SelectedItem.Text;
generateSynomyn(word);
}
This code is not executed when I select the first item on the index. In order to execute the code for the first item I have to select any other item first, then only the first item in the dropdownlist.
Also, can we automatically post back or at least make the selectItem the first item on the dropdownlist?
To make the
DropDownListfire for the first item you should enter a blank item, so a selection has to be made: