How to add a namespace automatically on each new page, a control is added to WebSite in VS2008?

How do you add a namespace automatically on each new page, a control is added to a website in VS2008?

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

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

}

I just need a page enclosed in a namespace, as shown 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.

It may be trivial, but I do not know how to do it.

+3
source share
2 answers

" " , .

+3

Visual Studio . , , "CodeBeside.cs" "C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\ItemTemplates\Web\CSharp\1033\WebForm.zip", , , . , ; - :

namespace $rootnamespace$
{
    public partial class $classname$ : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }
    }
}

$rootnamespace $ , , , -.

+1

Source: https://habr.com/ru/post/1703790/


All Articles