Author: Dollarjunkie | Posted on: 7/7/2009 9:04:28 AM | Views : 249

   I noticed something weird when handling state in my UserControl. Basically, all the Control?s Property Fields are saved in Viewstate for the control,
and when the Usercontrol is dynamically loaded on the page, the UNIQUE ID created for the control is saved. When the page posts back
using these Unique IDs, the UserControl and its Viewstate is supposed to be obtained and used to fill the form. Unfortunately,
the information seems to be getting lost when I do a postback that causes the controls to be recreated on the page.
 
 
Any idea what is missing here?
  public int empID { get { if (ViewState["EmployID"] != null) return Convert.ToInt32(ViewState["EmployID"]); ...

Go to the complete details ...