posted on Thursday, August 03, 2006 12:41 PM
by
timbarcz
VS.Net 2003 Developer Tip
I'm a fan of the #region tag usage in source code for easy collapsing and categorizing of code. What I set out to do was to see if there was a way to change the default behavior of VS.Net 2003. When I create a new webform, the aspx.cs file that is generated isn't set up the way I wanted. I find myself creating a lot of regions right off the bat. Here's what I found.
Navigate to: C:\Program Files\Microsoft Visual Studio .NET 2003\VC#\DesignerTemplates\1033 (or wherever you've installed Visual Studio .NET 2003)
Make changes to NewWebFormCode.cs
Here are the changes I made
using System; using System.Collections; using System.ComponentModel; using System.Data; using System.Drawing; using System.Web; using System.Web.SessionState; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.HtmlControls; namespace $NAMESPACE$ { /// /// Summary description for $CLASSNAME$. /// public class $CLASSNAME$ : System.Web.UI.Page { #region Controls #endregion #region Private #endregion #region Properties #endregion #region Internal Methods #endregion #region Control Events #endregion #region Page Events private void Page_Load(object sender, System.EventArgs e) { // Put user code to initialize the page here } #endregion #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.Load += new System.EventHandler(this.Page_Load); } #endregion } }
|
You'll notice there are other default templates there you can mess with and do similar things to.