Why ispostback not working with dropdown box

NittoMOD

New Member
I want to keep selected item after page reload:Excerpt from .aspx:\[code\] <asp:DropDownList ID="MyDropDown" runat="server" AutoPostBack="true" onselectedindexchanged="MyDropDown_SelectedIndexChanged"> </asp:DropDownList>\[/code\]Exerpt from .cs in page_load\[code\] if (!IsPostBack) { PopulateDropDownList(); }\[/code\]with\[code\] private void PopulateDropDownList() { MyDropDown.Items.Add("1"); MyDropDown.Items.Add("2"); } protected void MyDropDown_SelectedIndexChanged(object sender, EventArgs e) { Response.Redirect(Request.RawUrl); }\[/code\]
 
Back
Top