related #region Web Form Designer generated code
-
hi all, following code is automatically generated by visual studio #region Web Form Designer generated code override protected void OnInit(EventArgs e) { // // CODEGEN: This call is required by the ASP.NET Web Form Designer. // InitializeComponent(); base.OnInit(e); } /// /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// private void InitializeComponent() { this.ChkAll.CheckedChanged += new System.EventHandler(this.ChkAll_CheckedChanged); this.Load += new System.EventHandler(this.Page_Load); } #endregion but in my app this.ChkAll.CheckedChanged += new System.EventHandler(this.ChkAll_CheckedChanged); this.Load += new System.EventHandler(this.Page_Load); i m writting manually..this is not automatically generated; every time when i made changes in my page it is automatically erased why this happens?:confused: ------
-
hi all, following code is automatically generated by visual studio #region Web Form Designer generated code override protected void OnInit(EventArgs e) { // // CODEGEN: This call is required by the ASP.NET Web Form Designer. // InitializeComponent(); base.OnInit(e); } /// /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// private void InitializeComponent() { this.ChkAll.CheckedChanged += new System.EventHandler(this.ChkAll_CheckedChanged); this.Load += new System.EventHandler(this.Page_Load); } #endregion but in my app this.ChkAll.CheckedChanged += new System.EventHandler(this.ChkAll_CheckedChanged); this.Load += new System.EventHandler(this.Page_Load); i m writting manually..this is not automatically generated; every time when i made changes in my page it is automatically erased why this happens?:confused: ------
Hi there, This is a known issue of the VS 2003 as it sometimes resets the generated code in code-behind, and as a result of that your sample code could be removed also. In VS 2005, this thing does not happen since VS 2005 uses the inline code as default model to register the event handler. So in your case, there are a couple of ways which you may consider using to register the event handler: + Place your code in the Page_Init event, not in the generated code area. + Use the in-line code model, it means you can declare the event handler in the control declaration in the web page .aspx