473,387 Members | 1,483 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

page inheritance

Hi,
I just read the pattern "Design and Implementation Guidelines for Web
Clients" from MSDN.
Here is my question. In chapter 3,
http://msdn.microsoft.com/library/de...forwc-ch03.asp ,
the article mentions using page inheritance to maintain common page layout.

We currently use page inheritance approach to segment the function areas. In
each function area, there is a base page to provide the common
implementations for that function area, such as access control, rendering
header. There is also a master page which inherits the base page to load
different user controls based on different requests.

However, we cannot implement page inheritance without having the server-side
include files, which contain some common asp.net and html tags shared by all
aspx . By looking at Fig. 3.9, it is not very clear to me how the common
page elements, e.g. header, footer navigation areas were added to the pages
which extends the base page. My understanding of the asp.net page
inheritance is to use shared service-side include for asp.net pages (.aspx),
and base page class for code-behind (.aspx.cs).

Am I missing anything here?


I
Nov 18 '05 #1
5 2030
Any web page... inherits from the Page Class.....
if you are using code behind... you created a Derived class
the aspx is the final in the inheritance loop in that case.
CodeBehind class inherit Page class
ASPX page (again compiled to a class) inherits from CodeBehind class

now what you can do as per my understanding is create a derived class in
which inherits from Page
and from which your code behind (you can have all of you code behind inherit
from this one)

Yes you are right to an extent when you say that you dont have any server
side includes... like header... footer... etc
but what you have in replacement is User controls... Plus those headers and
footers in user controls and use the user controls as child controls to the
ASPX page....

You also have something called templated pages... now i havent looked into
what exactly they are but i think they are again used to add custom
requirements and you ASPX class or code behind class inherit from it... look
them up...

HTH

--
Regards,

HD

"Invalidlastname" <in*************@toomanyvalidations.page> wrote in message
news:OK**************@TK2MSFTNGP09.phx.gbl...
Hi,
I just read the pattern "Design and Implementation Guidelines for Web
Clients" from MSDN.
Here is my question. In chapter 3,
http://msdn.microsoft.com/library/de...forwc-ch03.asp , the article mentions using page inheritance to maintain common page layout.
We currently use page inheritance approach to segment the function areas. In each function area, there is a base page to provide the common
implementations for that function area, such as access control, rendering
header. There is also a master page which inherits the base page to load
different user controls based on different requests.

However, we cannot implement page inheritance without having the server-side include files, which contain some common asp.net and html tags shared by all aspx . By looking at Fig. 3.9, it is not very clear to me how the common
page elements, e.g. header, footer navigation areas were added to the pages which extends the base page. My understanding of the asp.net page
inheritance is to use shared service-side include for asp.net pages (.aspx), and base page class for code-behind (.aspx.cs).

Am I missing anything here?


I

Nov 18 '05 #2
I can certainly understand your confusion after reading the article you
referenced. The section on using Page Inheritance is pretty darned sketchy.
The clue as to what you're missing can be found in the last line of that
section: "The main disadvantage of using page inheritance is increased
complexity compared to the other options discussed in this section."
Apparently, the author didn't desire to go into any details.

The problem with using Page Inheritance to get common layout of course comes
with the Page Template. With the current version of ASP.Net you can't get
visual inheritance, so all of the layout controls have to do all of the
rendering of their HTML by themselves. And of course you have to deal with
the runat=server form. If you want all of the content in the page to be
inside the form, and you want the form to be inside a Panel or some other
HTML container class, the Panel must begin before the form and end after the
form (in order to contain it).

This can all be done via code in an inherited CodeBehind class, but as the
article stated, it is a complex task.

Server-side includes are procedural in nature rather than object-oriented,
and should be avoided.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

"Invalidlastname" <in*************@toomanyvalidations.page> wrote in message
news:OK**************@TK2MSFTNGP09.phx.gbl...
Hi,
I just read the pattern "Design and Implementation Guidelines for Web
Clients" from MSDN.
Here is my question. In chapter 3,
http://msdn.microsoft.com/library/de...forwc-ch03.asp , the article mentions using page inheritance to maintain common page layout.
We currently use page inheritance approach to segment the function areas. In each function area, there is a base page to provide the common
implementations for that function area, such as access control, rendering
header. There is also a master page which inherits the base page to load
different user controls based on different requests.

However, we cannot implement page inheritance without having the server-side include files, which contain some common asp.net and html tags shared by all aspx . By looking at Fig. 3.9, it is not very clear to me how the common
page elements, e.g. header, footer navigation areas were added to the pages which extends the base page. My understanding of the asp.net page
inheritance is to use shared service-side include for asp.net pages (.aspx), and base page class for code-behind (.aspx.cs).

Am I missing anything here?


I

Nov 18 '05 #3
Hi Invalidlastname,
Thank you for using Microsoft Newsgroup Service. Based on your description,
you want to confirm some concept on the "page ineritance" pattern in
ASP.NET. What you understanded is that when using a base page class, we
need two main roles:
1. Generate the base page class, which is used to be inherited by other
pages.
2. Provide a serverside include, which contains the page's base html layout

Please correct me if I misunderstood your description.

I think your understanding is quite correct. As for the page class, there
is no doubt on it since it provides the base page logic in it and other
pages inherit from it in the code behind page class. As for the "serverside
include", since the ASPX page is finally to be render as the html document
in the browser for user, also all the members in the behind page class has
relations with the html element. So when define a base page class, we need
not only the code logic, but also the display layout features, and the MSDN
has suggest us use the "include" ".inc" to provide the common page class's
html layout which will be include in all the derived page's aspx file. As
for more information on this pattern, you can refer the latest tech
articles on the MSDN which is called "PageController patter":

#About the PageController pattern
http://msdn.microsoft.com/architectu...ageController/

#Implementing Page Controller in ASP.NET
http://msdn.microsoft.com/architectu...ageController/

Please check out the preceding suggestion. If you have any questions on it,
please feel free to let me know.

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Nov 18 '05 #4
Hi Invalidlastname,
Have you had a chance to try my suggestion? If you have any question,
please feel free to let me know.

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
Nov 18 '05 #5
Steven,
Thanks for the response. The Page Controller with server-side includes are
exactly we are implementing for our project.
I read about some new features from asp.net 2.0, and one of them is defining
master page. I think the master page is a great way for implementing the
common looks and feels in the application. Before asp.net 2.0 available, the
server-side includes are good enough for our project. I agree the
server-side include approach is procedural rather than object-oriented, but
if we limit the uses of server-side includes for only holding some
placeholder controls and simple html, them the server-side includes make
application much easier to maintain then repeated html code fragments
everywhere.

ILN

"Steven Cheng[MSFT]" <v-******@online.microsoft.com> wrote in message
news:Ub**************@cpmsftngxa07.phx.gbl...
Hi Invalidlastname,
Have you had a chance to try my suggestion? If you have any question,
please feel free to let me know.

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Nov 18 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: BK | last post by:
I am writing a tiered inheritance structure in ASP.NET and would like opinions on the best way to accomplish the correct inheritance dynamically. The page structure is going to look similar to the...
1
by: George Durzi | last post by:
I'm converting a c# web application to support page inheritance so that I can really change the look and feel of my application by only modifying the ..cs that my pages inherit from. The only...
1
by: Andy Fish | last post by:
Hi, I have been thinking about the design of a large ASP.NET app and I've read people have a lot of trouble implementing front controller, especially with postbacks, so I don't feel comfortable...
1
by: Craig Street | last post by:
Hi How do i create a base page in ASP.NET 2.0? I don't want to use master pages as I don't need any visual inheritance. You could do this simply in ASP.NET 1.1 by creating a base page that...
3
by: Jim Heavey | last post by:
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...
4
by: roger janssens via DotNetMonster.com | last post by:
hello all. i'm used to scripting in php. there, you just include(bla.php) and it works. so i have a template that defines my layout and stays the same forever, but in that file, there's a table...
7
by: tshad | last post by:
I have a control that I am using from Metabuilders that requires you to use: <%@ Page Inherits="MetaBuilders.WebControls.DialogPage" %> How do I inherit my code-behind page or another object...
3
by: Pini | last post by:
Hi all,In asp.net 1.x i creates a basepage that extends System.Web.UI.Page class. I created this file in a web appplcaition project and then refernced it from another projects. All the pages in...
7
by: iguana84 | last post by:
Hi, I have a newbie question for (ASP.Net 2.0 framework) which is based on Design Pattern / Coding Trick --> I need to :- - Inherit one aspx page and its code (super abstract class)...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.