Oscar Cabrero Oscar Cabrero - 1 year ago 62
C# Question

How to add the namespace automatically on every new Page, Control added To a WebSite in VS2008?

How do you add the namespace automatically on every new Page, Control added To a website in VS2008?

When I add a new page, the code behind looks like this.

public partial class MyNewPage : System.Web.UI.Page
{

}


I just want the page wrapped into a namespace as below:

namespace Project.Web
{

public partial class MyNewPage : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e){}
}

}


This is done automatically when you have a website project.

Maybe it's trivial but I haven't find out how to do this.

Answer Source

Put the namespace under "Default Namespace" in project properties, and it doesn't need to be in the code files.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download