By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
457,696 Members | 1,512 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 457,696 IT Pros & Developers. It's quick & easy.

Standard Page - Inheritance...

P: n/a
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....
Nov 19 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
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 Heavey" <Ji*******@discussions.microsoft.com> wrote in message
news:F6**********************************@microsof t.com...
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....

Nov 19 '05 #2

P: n/a
Jim Heavey wrote:
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
Nov 19 '05 #3

P: n/a
"Kevin Spencer" <ke***@DIESPAMMERSDIEtakempis.com> wrote in message
news:ej**************@TK2MSFTNGP10.phx.gbl...
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
--
HTH,

Kevin Spencer
Microsoft MVP
.Net Developer
Neither a follower nor a lender be.

"Jim Heavey" <Ji*******@discussions.microsoft.com> wrote in message
news:F6**********************************@microsof t.com...
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....


Nov 19 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.