Standard Page - Inheritance...

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello, my company has a standard format that I must follow when creating a
page.
The top portion of the page contains a standard heading which should be
placed on each page. This "heading" has a form and some javascript which has
"action" which invokes some javascript.
I am trying to figure out how I can standardize this so that I do not have
to copy this code to each and every page. I thought I might be able to use a
"User Control", but I do not think I can do this because it would involve
another form and I am not too sure if one form can contain another form. I
think you can have more then one form provided that only one of them is
marked with a "runat=server". But I do not think one form can contain
another form.

Can I create a base page with all of this code in it and them inherit that
page on subsequent pages? I am not quite sure how you would do this
inheretance ...you would have an "aspx" page and then you would have your
code behind on the base page a "aspx.cs". When you create your first page
what statement would you place in that page to inherit from the base page?
Is there some property you can set in Visual studio to tell it that all new
pages which are create will inherit from this base page? The base page would
or would not contain the form with the runat parameter?

Thanks in advance for your assistance....
 
Hi Jim,

You might want to take a look at ASP.Net 2.0 (whidbey). It has a new item
called "Master Pages" which sounds exactly like what you want. Otherwise,
you will have to go with Controls that are used in all pages. The current
version of ASP.Net does not support visual inheritance.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Neither a follower nor a lender be.
 
Jim said:
Can I create a base page with all of this code in it and them inherit that
page on subsequent pages? I am not quite sure how you would do this
inheretance ...you would have an "aspx" page and then you would have your
code behind on the base page a "aspx.cs". When you create your first
page
what statement would you place in that page to inherit from the base page?
Is there some property you can set in Visual studio to tell it that all
new
pages which are create will inherit from this base page? The base page
would
or would not contain the form with the runat parameter?

Thanks in advance for your assistance....

You might be able to use the page template concept at:

http://www.wilsondotnet.com/Demos/Generator.aspx

In the "template" dropdown box, select "Direct Render", then click the
"Generate Code" button a little ways down the page.

Ben
 
Kevin Spencer said:
Hi Jim,

You might want to take a look at ASP.Net 2.0 (whidbey). It has a new item
called "Master Pages" which sounds exactly like what you want. Otherwise,
you will have to go with Controls that are used in all pages. The current
version of ASP.Net does not support visual inheritance.

Clarification: that last sentence means that you'll have problems in Design
mode if you inherit from a base page.

John Saunders
 

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

Back
Top