How to persist user control values?
问题 I want to persist user control values If I add one more rows the previous control values is not there I gone through some sites but I'm not able to understand clearly Code: protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { ViewState["ControlCount"] = ViewState["ControlCount"] == null ? 2 : ViewState["ControlCount"]; } } public int controlCount { get { int val = 0; try { val = (int)ViewState["ControlCount"]; } catch (Exception e) { // handle exception, if required. }