Create namespace when automatically generating classes of web pages/controls

Discussion in 'ASP .Net Web Controls' started by Tokes, Apr 12, 2007.

  1. Tokes

    Tokes Guest

    Hi there,

    I'm using Visual Studio 2005 and I am working with a C# web project.
    In this project I have a few directories to organise my pages and
    controls.

    When I create a new control in a sub directory (e.g. Controls), and
    give it a name (e.g. MyUserControl), I find that in the generated .cs
    file, the class name that has been assigned is
    'Controls_MyUserControl', i.e. its full directory path, with
    underscores instead of slashes. What I would have liked is if the
    generated class was put inside a namespace (Controls), and that the
    class name was just the name of the control (MyUserControl) - so that
    its full name would be 'Controls.MyUserControl'.

    Is there some way to tell Visual Studio to do this?

    Thanks in advance,
    - Tokes
    Tokes, Apr 12, 2007
    #1
    1. Advertising

  2. Tokes

    marss Guest

    Tokes wrote:
    > Hi there,
    >
    > I'm using Visual Studio 2005 and I am working with a C# web project.
    > In this project I have a few directories to organise my pages and
    > controls.
    >
    > When I create a new control in a sub directory (e.g. Controls), and
    > give it a name (e.g. MyUserControl), I find that in the generated .cs
    > file, the class name that has been assigned is
    > 'Controls_MyUserControl', i.e. its full directory path, with
    > underscores instead of slashes. What I would have liked is if the
    > generated class was put inside a namespace (Controls), and that the
    > class name was just the name of the control (MyUserControl) - so that
    > its full name would be 'Controls.MyUserControl'.
    >
    > Is there some way to tell Visual Studio to do this?
    >
    > Thanks in advance,
    > - Tokes


    If you are just starting a new project then install Service Pack 1 for
    VS 2005, and use the Web Application project type instead of the Web
    Site one.
    Regards
    marss, Apr 12, 2007
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Nathan Sokalski
    Replies:
    5
    Views:
    1,001
    Gaurav Vaish \(www.Edujini-Labs.com\)
    Jan 10, 2007
  2. Juha Nieminen
    Replies:
    11
    Views:
    726
    James Kanze
    Mar 2, 2009
  3. Nathan Sokalski
    Replies:
    4
    Views:
    280
    Nathan Sokalski
    Dec 21, 2006
  4. Nathan Sokalski
    Replies:
    4
    Views:
    316
    Nathan Sokalski
    Dec 21, 2006
  5. Replies:
    3
    Views:
    94
Loading...

Share This Page