I have a form in which I have a ComboBox control with two values.
Once the user selects one item in the list, I need to display a table of data corresponding to the option selected.
if (DropDownList1.SelectedValue == 1)
{
// open a SqlCommand
// read values
// fill table
}
else if (DropDownList1.SelectedValue == 2)
{
// etc
The problem is that I only want to fill the table after the user makes a selection. But when the form is loaded the ComboBox automatically chooses the first option and my code runs, filling the table.
How do I prevent this from happening?