How To Work around Visual Studio.NET auto format bug?

时间:2023-01-14 23:30:34
 

How To Work around Visual Studio.NET auto format bug?

 

  1. VS.NET may remove your code when you switch from HTML view to Design view.

Solution: So need to default to HTML view when open the aspx page

 

You can go Tools/Options/HTML Desinger/General as the following screen shoot.

 

 

  1. VS.NET may remove your events code in the InitializeComponent. You can see unfired event, like Button click won’t work, Page load code won’t work.

 

Solution: Copy the code inside the method InitializeComponent. Comment it out and put before the method InitializeComponent as the following code. If VS.NET remove your code automatically, you can simply copy it back.

 

//this.GoButton3.Click += new stem.Web.UI.ImageClickEventHandler(this.GoButton3_Click);

// this.Load += new System.EventHandler(this.Page_Load);

 

private void InitializeComponent()

{   

this.GoButton3.Click += new System.Web.UI.ImageClickEventHandler(this.GoButton3_Click);

this.Load += new System.EventHandler(this.Page_Load);

 

}