Create namespace when automatically generating classes of web pages/controls

T

Tokes

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
 
M

marss

Tokes said:
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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top