I have the following code:
protected void DropDownList1_DataBound(object sender, EventArgs e)
{
string CQS = Page.ClientQueryString.ToString();
int YearID = CQS.IndexOf("yearID");
string strYearID;
if (YearID == -1)
{
strYearID = SqlDataSource3.SelectParameters["yearID"].DefaultValue.ToString();
}
else
{
strYearID = CQS.Substring(YearID + 7);
}
// DropDownList1.ClearSelection();
DropDownList1.SelectedIndex = DropDownList1.Items.IndexOf(DropDownList1.Items.FindByText(strYearID));
//What code here?
Label1.Text = DropDownList1.SelectedValue;
}
The code is intended to make the dropdown list match the data I sent it in the query string. (If I send 1999, I want 1999 to be the SelectedItem in my DropDownList) and it works, but...
Every postback to the server is being intrepreted as SelectedIndexChange ...
Go to the complete details ...