c# - Page lifecycle question -


i using dropdown menu , updatepanel filter out datagrid. datagrid has buttons redirect different page. when hit button or link on top of other page, redirects me page dropdown should...but gets rid of datagrid data , have make selection dropdown again. there way make sure dropdown selection remembered when both link pressed , button selected? help!

the easiest thing in case save dropdown selection in session collection , on page load, check see if there saved selection , use reapply selection.

protected void dropdownlist1_selectedindexchanged(object sender, eventargs e) {      session["savedselection"] = dropdownlist1.selectedindex; }  protected void page_load(object sender, eventargs e) {     if(session["savedselection"] != null)     {         int  selectedindex = (int) session["savedselection"];         dropdownlist1.selectedindex = selectedindex;     }  } 

Comments

Popular posts from this blog

c# - How to set Z index when using WPF DrawingContext? -

razor - Is this a bug in WebMatrix PageData? -

visual c++ - Using relative values in array sorting ( asm ) -