Page Templating for Web Applications
page 1 of 5
Published: 03 Oct 2003
Unedited - Community Contributed
Abstract
Covers a page templating scheme designed specifically for use with postback intensive web applications. This article was one of the first covering page templating for ASP.NET.
by J. Ambrose Little
Feedback
Average Rating: This article has not yet been rated.
Views (Total / Last 10 Days): 32290/ 101

Introduction

Originally Published: 2 October 2002

I've seen quite a few different templating schemes around since I started looking for them, but most had two flaws. One is the requirement to either use a UserControl for every page or to load the controls into a template user control, which in both cases overcomplicates things and makes client-side scripting more obscure due to ASP.NET's unique Id system. The other is that most do not support view state properly, which is a consequence of changing the location of controls in the control tree after they're initially parsed into the tree.

Neither of these seemed acceptable to me, so I kept toying with the various schemes trying to arrive at what I thought to be the best of both worlds. The purpose of this article is to share that with you. The key to solving the view state problem lies in intercepting (overriding) ASP.NET's AddParsedSubObject method, which adds the controls parsed from the ASPX page to the control tree.

 


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-2017 ASPAlliance.com  |  Page Processed at 2017-08-23 1:42:14 PM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search