Visual inheritance...

P

Paul M

Hi folks,

I've got a page that contains the basic formatting that I need for pretty
much all of my systems pages. It's compiled into it's DLL, distributed to
my application's \bin folder and VS allows me to use the class thus :

Public Class Job
Inherits DefaultPage.DefaultPage

The application compiles and runs and is generally happy, but my formatting
isn't there.

There isn't any functionality in the base class, just formatting (header
graphics and couple of hyperlinks).

Can someone point me in the right direction? Is it even possible, or should
I just stick with an HTML includes reference?

Thanks in advance...

P
 
C

Chris Jackson

What you want is going to be in ASP.NET 2.0 (Whidbey). For now, you can use
ASCX controls to put in distinct bits of visual information (a control for
the header, a control for the side bar, etc.). You can also pump that in
using the inheritance method, but it's going to be a bit tougher. Remember,
the actual page that is rendered is based on the aspx declarative page,
which inherits from your code behind, which inherits from your base class.
In order to render successfully, you could have something like (VERY much
pseudocode):

page.aspx - inherits from page.aspx.cs:
<asp:placeHolder id="header">
my content here
<asp:placeHolder id="footer">

page.aspx.cs - inherits from BasePage class
....

BasePage.cs
protected System.Web.UI.WebControls.PlaceHolder header;
protected System.Web.UI.WebControls.PlaceHolder footer;
header.Controls.Add(/* some nice visual bits here */);
footer.Controls.Add(/* some nice visual bits here */);

As you can start to see, you will be doing visual designing without a
designer or even a declarative syntax - not much fun. I would go the ASCX
route until Whidbey comes out. :)
 

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,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top