Search:

Home | Www - Internet | Web Designing


The ASP.NET Template Engine

By: christine layug

When first released, ASP.NET lacked a template engine. Because the .NET framework is object-oriented and allows for inheritance, many developers would define a new base class that inherits from "System.Web.UI.Page", write methods here that render HTML, and then make the pages in their application inherit from this new class.
While this allows for common elements to be reused across a site, it adds complexity and mixes source code with markup. Furthermore, this method can only be visually tested by running the application - not while designing it. Other developers have used include files and other tricks to avoid having to implement the same navigation and other elements in every page.
ASP.NET 2.0 introduced the concept of "master pages", which allow for template-based page development. A web application can have one or more master pages, which can be nested.
Master templates have place-holder controls, called ContentPlaceHolders to denote where the dynamic content will go, as well as HTML and JavaScript that will be shared across child pages. Learn more about this with the austin .net consultant.
Child pages use those ContentPlaceHolder controls, which must be mapped to the place-holder of the master page that the content page is populating. The rest of the page is defined by the shared parts of the master page, much like a mail merge in a word processor. All markup and server controls in the content page must be placed within the ContentPlaceHolder control.
When a request is made for a content page, ASP.NET merges the output of the content page with the output of the master page, and sends the output to the user. Visit the austin .net consultant to learn more about it.
The master page remains fully accessible to the content page. This means that the content page may still manipulate headers, change title, configure caching etc. If the master page exposes public properties or methods the content page can use these as well. For more information on what ASP.NET is capable of doing, then visit the austin .net consultant for more details.

Article Source: http://www.rightarticle.com

www.astonishdesigns.com





Please Rate this Article

 

Not yet Rated

Click the XML Icon Above to Receive Web Designing Articles Via RSS!

Powered by Article Dashboard