AutoPostBack
DropDownList
SelectedIndexChanged
Session["lastSelectedCountryIndex"] = DropDownList1.SelectedIndex;
OnLoad
if (Session["lastSelectedCountryIndex"]!=null) DropDownList2.SelectedIndex = Convert.ToInt32((Session["lastSelectedCountryIndex"]).ToString());
protected void Page_Load(object sender, EventArgs e) { ListBox2.Text = <call the session value> }
public void page_load() { if(!IsPostBack) { DropDownList ddl = (DropDownList)PreviousPage.FindControl("DropDownList1"); DropDownList2.SelectedIndex = ddl.SelectedIndex; } }
DropDownListID.Items.FindByValue("yourValue").Selected = true;
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)