473,395 Members | 1,568 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

partial class and namespace

Hi
I want to use namespaces to organize all the classes, web forms, and user
controls. It works fine with my user defined classes, but when I try to put
all the web pages in a namespace for example
namespace myCompany. MyApp.Web
{
}
the page starts throwing error, and rightly so because, its a partial class
public partial class _Default : System.Web.UI.Page
and the other part of it is not in the same namespace. The error message in
VS is

Error 1 Make sure that the class defined in this code file matches the
'inherits' attribute, and that it extends the correct base class

Is there anyway around this problem.

-Sami


Feb 13 '07 #1
4 7392
If you right click on your project in Solution Explorer, choose Properties,
then Application, you will see where you can set the default namespace.
Peter

--
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
Short urls & more: http://ittyurl.net


"Sami Rehman" wrote:
Hi
I want to use namespaces to organize all the classes, web forms, and user
controls. It works fine with my user defined classes, but when I try to put
all the web pages in a namespace for example
namespace myCompany. MyApp.Web
{
}
the page starts throwing error, and rightly so because, its a partial class
public partial class _Default : System.Web.UI.Page
and the other part of it is not in the same namespace. The error message in
VS is

Error 1 Make sure that the class defined in this code file matches the
'inherits' attribute, and that it extends the correct base class

Is there anyway around this problem.

-Sami


Feb 13 '07 #2
i have dont that for the class library projects in my solution but i dont
seem to find that defualt namespace setting option in the web site project.
when i right click on the web site, i do see a Property Pages option but it
does not have any Application selection of default namespace option in it.
"Peter Bromberg [C# MVP]" <pb*******@yahoo.yabbadabbadoo.comwrote in
message news:23**********************************@microsof t.com...
If you right click on your project in Solution Explorer, choose
Properties,
then Application, you will see where you can set the default namespace.
Peter

--
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
Short urls & more: http://ittyurl.net


"Sami Rehman" wrote:
>Hi
I want to use namespaces to organize all the classes, web forms, and user
controls. It works fine with my user defined classes, but when I try to
put
all the web pages in a namespace for example
namespace myCompany. MyApp.Web
{
}
the page starts throwing error, and rightly so because, its a partial
class
public partial class _Default : System.Web.UI.Page
and the other part of it is not in the same namespace. The error message
in
VS is

Error 1 Make sure that the class defined in this code file matches the
'inherits' attribute, and that it extends the correct base class

Is there anyway around this problem.

-Sami



Feb 14 '07 #3
Maybe you should consider switching to the Web Application Project model?
This is available in Service Pack 1.
Peter

--
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
Short urls & more: http://ittyurl.net


"Sami Rehman" wrote:
i have dont that for the class library projects in my solution but i dont
seem to find that defualt namespace setting option in the web site project.
when i right click on the web site, i do see a Property Pages option but it
does not have any Application selection of default namespace option in it.
"Peter Bromberg [C# MVP]" <pb*******@yahoo.yabbadabbadoo.comwrote in
message news:23**********************************@microsof t.com...
If you right click on your project in Solution Explorer, choose
Properties,
then Application, you will see where you can set the default namespace.
Peter

--
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
Short urls & more: http://ittyurl.net


"Sami Rehman" wrote:
Hi
I want to use namespaces to organize all the classes, web forms, and user
controls. It works fine with my user defined classes, but when I try to
put
all the web pages in a namespace for example
namespace myCompany. MyApp.Web
{
}
the page starts throwing error, and rightly so because, its a partial
class
public partial class _Default : System.Web.UI.Page
and the other part of it is not in the same namespace. The error message
in
VS is

Error 1 Make sure that the class defined in this code file matches the
'inherits' attribute, and that it extends the correct base class

Is there anyway around this problem.

-Sami




Feb 14 '07 #4
Got it! Thanks.
its strange though that they dont have this feature for website projects
"Peter Bromberg [C# MVP]" <pb*******@yahoo.yabbadabbadoo.comwrote in
message news:70**********************************@microsof t.com...
Maybe you should consider switching to the Web Application Project model?
This is available in Service Pack 1.
Peter

--
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
Short urls & more: http://ittyurl.net


"Sami Rehman" wrote:
>i have dont that for the class library projects in my solution but i dont
seem to find that defualt namespace setting option in the web site
project.
when i right click on the web site, i do see a Property Pages option but
it
does not have any Application selection of default namespace option in
it.
"Peter Bromberg [C# MVP]" <pb*******@yahoo.yabbadabbadoo.comwrote in
message news:23**********************************@microsof t.com...
If you right click on your project in Solution Explorer, choose
Properties,
then Application, you will see where you can set the default namespace.
Peter

--
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
Short urls & more: http://ittyurl.net


"Sami Rehman" wrote:

Hi
I want to use namespaces to organize all the classes, web forms, and
user
controls. It works fine with my user defined classes, but when I try
to
put
all the web pages in a namespace for example
namespace myCompany. MyApp.Web
{
}
the page starts throwing error, and rightly so because, its a partial
class
public partial class _Default : System.Web.UI.Page
and the other part of it is not in the same namespace. The error
message
in
VS is

Error 1 Make sure that the class defined in this code file matches the
'inherits' attribute, and that it extends the correct base class

Is there anyway around this problem.

-Sami





Feb 15 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

21
by: nospam | last post by:
Ok, I asked this question before and I also looked at the book "First Look at ASP.NET 2.0" I also read Paul wilson's web page explanation. HOWEVER...... The book and that web page talks about...
7
by: Kai-Uwe Bux | last post by:
Hi folks, I observed something that puzzles me. When I do namespace xxx { using std::swap; } it appears that xxx::swap and std::swap are not strictly equivalent. In particular, I think...
9
by: Gomaw Beoyr | last post by:
Two question about the "partial classes" (in the next wersion of ..NET). Question 1 ========== Will partial classes (in the next version of C#) have to be declared "partial" in ALL places. ...
7
by: Patrick | last post by:
Hi all, I was playing around with ASP.Net 2.0 and recognized that in case you use Code-Behind/Beside (how is it called in future?) the parser still creates TWO classes one partial class under...
9
by: Fat Elvis | last post by:
I'd like to extend some of my Asp.net pages by using Partial Classes. Example ASP.Net Page: public partial class Admin_Customer : System.Web.UI.Page { protected void Page_Load(object sender,...
0
by: Dr. Peer Griebel | last post by:
I'm currently writing a small toy application to support symbolic algebra. Therefore I implemented some classes Term, Var, Number, Sum, Product, Power. These classes are tightly coupled. So it...
3
by: vivekian | last post by:
Hi, Is there a way to have partial classes across different namespaces ? namespace a.b.c { public partial class X { private void MyMethod () { } }
5
by: SAL | last post by:
Hello, I would like to be able to set the WHERE clause of a select statement on the fly. I have a DataAccess layer designed using the DataSet designer and a BusinessLogic layer using classes. The...
2
by: Peted | last post by:
Hi, im moving a project from vs2005 to vs 2008. is doing so i have come across a compiler error regarding partial classes that i dont understand if anyone can explain it to me please the...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.