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

Summary
 
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
Comment:
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.

Cheers,
H
Title: Rendering Controls   
Name: Ambrose
Date: 2005-09-23 10:08:57 AM
Comment:
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
Comment:
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
Comment:
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
Comment:
Got some great ideas/code from this on how to add user controls to build up a page using templates and inheritance.
Also see http://www.codeproject.com/aspnet/page_templates.asp
for more great info on page inheritance and asp.net 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
Comment:
Helps me solve the view state problem
Title: Nicewhan bruvva!   
Name: Nik
Date: 2004-10-21 8:49:07 PM
Comment:
Good article. I'll find this very useful.






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


©Copyright 1998-2024 ASPAlliance.com  |  Page Processed at 2024-04-19 1:08:53 AM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search