If I use QueryString to return the value of something stored in the URL and then populate a drop list with it that value like below:
industry = Request.QueryString["ind"].ToString();
industrydropdown.SelectedValue = industry;
category = Request.QueryString["cat"].ToString();
CatDropDown.SelectedValue = category
CatDropDown is filled automatically using code behind on SelectedIndexChanged with AutoPost Back enabled on industrydropdown.
protected void industrydropdown_SelectedIndexChanged(object sender, EventArgs e)
{
string value = industrydropdown.SelectedValue;
switch (value)
{
case "Ind1":
CatDropDown.Items.Clear();
CatDropDown.Items.Add("Categories for Ind1");
break;
case "Ind2":
CatDropDown.Items.Clear();
CatDropDown.Items.Add("Categories for Ind2");
break;
}
How would I go about filling my CatDropDownList from the QueryString when I am also using the on SelectedIndexChanged to fill the second drop down. Is this possible?
You can put the code in separate method of populating Category Dropdownlist. e.g.
and then