partial classes and web user controls

VBAHole22

Contributor
Joined
Oct 21, 2003
Messages
432
Location
VA
I'm just starting out in asp.net 2.0 and finding out alot of things have changed. Alot of things.
Anyway I'm writing a website that has a main default page with a few divs for header and nivigation and whatnot. Then I make user controls and swap them in the middle pane. Real simple like. In VS03 I would have all of my pages in a namespace and then things like data tier access in another namespace for neatness. But now when I generate a control in 2.0 I don't get a namespace attirbute on the top, instead I get a partial class. When I try to add the namespace in the code behind I get an error about the partial class name not jiving with the inherits tag and maybe I'm not doing something correctly

Code:
Error	1	Make sure that the class defined in this code file matches the 'inherits' attribute, and that it extends the correct base class (e.g. Page or UserControl)

Can I no longer have namespaces like I used to?
 
If you look at the html in the aspx file, at the top there should be an @Page directive, find the inherits=".." attribute and modify this so it also includes the namespace.

Then again if you are using 2005 have you considered moving to a masterpage form of layout - will make a easier solution than usercontrols for this kind of thing.
 
Back
Top