Page Templating for Web Applications
page 5 of 5
by J. Ambrose Little
Average Rating: This article has not yet been rated.
Views (Total / Last 10 Days): 29908/ 32

To summarize, this templating scheme provides you strongly-typed properties, such as page title, stylesheet, and the server-side form, as well as several PlaceHolder controls to enable the page developer to programmatically add controls to various places on the page's control tree. It automatically adds all controls to the server-side form to enable them to participate in ASP.NET's object-oriented postback processing and view state. By intercepting the AddParsedSubObject method and adding the objects to a temporary control collection, it enables view state for all controls added to the tree in the template.

This scheme also allows the developer to create as many sub-templates from this template as desired by creating similar template classes that derive from this one. It has been tested on a major intranet project and is being used on this site. On these, performance impact is minimal, and usability for the page developers on my team has proven to be good.

Overall, for postback-intensive applications, I think this scheme or some variation of it is the best solution for page templating. The only difficulties I have found with it are accounting for multiple default buttons and providing full design-time support, both of which have workable remedies.

View Entire Article

User Comments

Title: An idea   
Name: Hans
Date: 2007-01-29 5:17:42 AM
If you want intellisene without having to add body tags to the pages you can go into Tools -> Options -> Text Editor -> File Extension and add the "aspx" extension to the User Control Editor.

Title: Rendering Controls   
Name: Ambrose
Date: 2005-09-23 10:08:57 AM
John, that sounds like a big question and one that isn't entirely clear (to me anyways). You might try asking over at the ASP.NET Forums; it's better suited to general questions.
Title: good article   
Name: John
Date: 2005-09-23 12:16:25 AM
how do we render the controls to the web page and still be able to interact with the server as if it is a web server control.
Title: excellent   
Name: A Anderson
Date: 2005-09-20 10:16:29 PM
Excellent work. I would like to express my interest in your part two. :-) thanks.
Title: Good Ideas!   
Name: Greg Olsen
Date: 2004-12-06 5:47:11 AM
Got some great ideas/code from this on how to add user controls to build up a page using templates and inheritance.
Also see
for more great info on page inheritance and templates. These two sites allow for any beginner to architect a good website structure.
Title: Very good   
Name: Yao Liu
Date: 2004-11-02 3:44:22 PM
Helps me solve the view state problem
Title: Nicewhan bruvva!   
Name: Nik
Date: 2004-10-21 8:49:07 PM
Good article. I'll find this very useful.

Community Advice: ASP | SQL | XML | Regular Expressions | Windows

©Copyright 1998-2024  |  Page Processed at 2024-04-13 10:15:36 PM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search