Tuesday, May 03, 2005

ASP.NET 1.1 Master Pages

I was too impatient to wait for .NET 2.0's Master Pages, so I started to look at some of the (many) implementations for master pages in ASP.NET 1.1 ...


I ran across this article at CodeProject and I started to implement it in my new project. The basic idea behind it is to parse a child page (Context Page) and before Viewstate is even loaded, it does a Server.Execute to execute the desired master page, and the master page just loads its controls into the HttpContext (it makes sure not to render itself). The execution resumes at the Context page and the entire control collection of <form> is copied into a specifically named control and finishes execution!



The master page looks like this:


<html>
...
//header & navigation
<div id="masterContextContainer"> </div>

//footer
</html>




That's it! Mark the class with the [MasterPage()] attribute and it's ready to go!



The Context Page is just a normal aspx page that has the class marked as [ContextPage(masterPageAlias)] and it's done.



There are a number of different methods to accomplish this, but I found this one to be very nice because A) I can inherit my PageBase class from this MasterContextPage and start using it on existing web forms... B) it's very clever!


The only thing I found that is a little iffy is the Tracing. If you have both pages enabled it messes up, so make sure and set the Master Page to trace="false" so that you don't get any conflicts with control id's.
#    Comments [0] | Trackback
Tracked by:
"online slot machine" (online slot machine) [Trackback]
"phentermine" (phentermine) [Trackback]
"interest rates" (interest rates) [Trackback]
"citicard" (citicard) [Trackback]
"louisville hotels" (louisville hotels) [Trackback]
"pills" (pills) [Trackback]
"online poker game" (online poker game) [Trackback]
"equity loan" (equity loan) [Trackback]
"credit card rate" (credit card rate) [Trackback]
"ambien" (ambien) [Trackback]
"credit report score" (credit report score) [Trackback]
"debt settlement" (debt settlement) [Trackback]
"poker" (poker) [Trackback]
"Viagra" (Viagra) [Trackback]
"phentermine online" (phentermine online) [Trackback]
"celebrex" (celebrex) [Trackback]
"Blackjack" (Blackjack) [Trackback]
"buy xenical" (buy xenical) [Trackback]
"adipex" (adipex) [Trackback]
"phentermine" (phentermine) [Trackback]
"phentermine online prescription" (phentermine online prescription) [Trackback]
"casinos" (casinos) [Trackback]
"blackjack" (blackjack) [Trackback]
"casinos" (casinos) [Trackback]
"Slots" (Slots) [Trackback]
"Cialis" (Cialis) [Trackback]
"ambien" (ambien) [Trackback]
"buy viagra" (buy viagra) [Trackback]
"phentermine" (phentermine) [Trackback]
"xenical" (xenical) [Trackback]
"online casinos" (online casinos) [Trackback]
"online poker" (online poker) [Trackback]
"online casinos" (online casinos) [Trackback]
"online casino review" (online casino review) [Trackback]
"cialis" (cialis) [Trackback]
"phentermine" (phentermine) [Trackback]
"buy tramadol" (buy tramadol) [Trackback]
"phentermine" (phentermine) [Trackback]
"casinos" (casinos) [Trackback]
"online casinos" (online casinos) [Trackback]
"casino" (casino) [Trackback]
"phentermine online" (phentermine online) [Trackback]
"phentermine online" (phentermine online) [Trackback]
"play slots" (play slots) [Trackback]
"casinos" (casinos) [Trackback]
"online blackjack" (online blackjack) [Trackback]
"casino game" (casino game) [Trackback]
"cialis" (cialis) [Trackback]
"order viagra" (order viagra) [Trackback]
"online casino" (online casino) [Trackback]
"buy phentermine" (buy phentermine) [Trackback]
"fioricet" (fioricet) [Trackback]
"phentermine" (phentermine) [Trackback]
"online casino" (online casino) [Trackback]
"ultram" (ultram) [Trackback]
"Lipitor" (Lipitor) [Trackback]
"phentermine" (phentermine) [Trackback]
"Tamiflu" (Tamiflu) [Trackback]
"buy phentermine" (buy phentermine) [Trackback]
"phentermine" (phentermine) [Trackback]
"casino" (casino) [Trackback]
"viagra" (viagra) [Trackback]
"slots" (slots) [Trackback]
"phentermine" (phentermine) [Trackback]
"casino" (casino) [Trackback]
"online casino gambling" (online casino gambling) [Trackback]
"adipex" (adipex) [Trackback]
"bingo" (bingo) [Trackback]
"ultram" (ultram) [Trackback]
"buy phentermine" (buy phentermine) [Trackback]
"online casino" (online casino) [Trackback]
"zithromax" (zithromax) [Trackback]
"purchase phentermine" (purchase phentermine) [Trackback]
"phentermine online" (phentermine online) [Trackback]
"phentermine" (phentermine) [Trackback]
"ultram online" (ultram online) [Trackback]
"phentermine" (phentermine) [Trackback]
"casino" (casino) [Trackback]
"phentermine" (phentermine) [Trackback]
"online casino guide" (online casino guide) [Trackback]
"online slots" (online slots) [Trackback]
"phentermine" (phentermine) [Trackback]
"phentermine" (phentermine) [Trackback]
"phentermine" (phentermine) [Trackback]
"casino" (casino) [Trackback]
"xenical" (xenical) [Trackback]
"phentermine" (phentermine) [Trackback]
"free casino games" (free casino games) [Trackback]
Loans - Credit Counseling - Personal Loans - Debt Loans