Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Page Inheritance

Status
Not open for further replies.

JuanitaC

Programmer
Feb 21, 2001
292
CA
We are beginning a project to recode our application in ASP.NET, and are just trying to sort out our architecture.

We have a PageTemplate class that has our interface elements, and that is inherited by our base product. This all works great, having the PageTemplate use the Control collection and overriding AddParsedSubObject, based on an example by J. Ambrose Little on asp.net.

Now, we customize the base product for numerous clients, (sometimes just one page, sometimes multiple pages) and want to inherit from the base product. Our problem is that we can't find any way to inherit from the base product aspx files. All the code behind stuff inherits fine, it is just the page interfaces that we are having trouble with. We want to avoid having a copy of all the pages for each customization, because that will make maintenance a nightmare - if there is a change to one page, we will have to update each and every site with that change.

Everything I have read so far indicates that you can't inherit from aspx files.

So my question is: is there a way around this, or are we going to have to reconsider our entire architecture to make this work?
 
From my understanding, there is no way to inherity from an aspx page.

From what I've seen, the solution some people have done is instead of treating the page as a template, making aspects of the page user controls.

The idea being that you just update the user controls as opposed to the page (the page just holds the collection of controls and thats it).

D'Arcy
 
Our problem with the user control idea is that some customizations will require changes to the page - html, layout, add fields, remove fields, etc. We were hoping that this could be accomplished through inheritance, with overriding methods, etc.

I guess we will just continue to think about how we need this to work and see what comes up in future research.
 
You can inherit a base usercontrol and add items from there? Not sure if that includes the visual part of it also or not I haven't ever tried that. That'l do donkey, that'l do
[bravo] Mark
If you are unsure of forum etiquette check here faq796-2540
 
There's always <gasp> include files.

They still work in asp.net, and might very well serve your purpose.

I haven't tested it, but I'd say there's a 50/50 chance it might work. The only problem being if your codebehind pages actually require the various objects exist on the page at design time, rather than settling for them to be included at run time.

Worth a shot, though.

-paul
penny1.gif
penny1.gif

The answer to getting answered -- faq855-2992
 
Actually, I would suggest not even trying that. It's definitely a kludge.

The real way to do this if you have to use inheritance would be to write custom server controls that you would drop on the various pages.

Then, yes, you would have a page for every client, but the page just contains the reference to the compiled derived server control, which you can manipulate via code.

I'm nearly positive that there isn't a way to do it exactly as you've described, but in this scenario, if something changes company wide, you simply manipulate your base object, and your changes cascade across all your pages, which I assume is what you're after.

-paul
penny1.gif
penny1.gif

The answer to getting answered -- faq855-2992
 
Thanks for all of the suggestions.

Link9, I had to laugh at the include file suggestion, as that is how we manage this now in Classic ASP. :) And it is getting to be quite a headache!

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top