Using a 'Master Page'
Frankly, this topic doesn't really relate to the 'Login Control' at all.
However, switching to a concept of using a 'Master Page' really makes things easier for the
web developer. - That's why we'll introduce it now.
The 'Master Page'/'Content Page' concept - associates TWO pages everytime you call up a link (using a
master page).
The 'Master Page' - Contains items that are the same for all pages while the 'Content Page' -
only contain the information that is different for that particular 'page' (or 'content').
In our case, we'll use the default file name for our master page which is 'MasterPage.master'. - Also,
like any .aspx page, the 'master page' can also have it's own VB code file.
The following image shows a 'home page' using both a mster page ('MasterPage.master') and a content page
('default.aspx'). - You'll note it looks like any other 'HTML' page. - That's because Net.Frameworks assembles the
two pages into one before sending it to the browser.

In 'VWD' load up 'MasterPage.master' and switch to 'Design' view. - See tht we set up a 'background color' of
'aqua' for the master page? - Note that we have set up a 'header section' (and moved our 'Login Control' here). -
We added our menu items to the left side of the page. And finally, we set up a 'footer' section.
Note tht in the center of the page is an area for the 'content' of .aspx pages that will be loaded along with
the master.

Now load up 'default.aspx' in VWD and switch to 'Design' View. - See everything that is 'greyed-out'? - That is
stuff in the 'master page'. - The non-greyed area is the actual 'content' of 'default.aspx.

Wow! - This is pretty cool. - How do you do it?
With 'default.aspx' loaded in VWD, switch to 'Source' View. - Notice the top line. - You'll see where we reference
the 'master' page.
'default.apxp' has no <html>.....</html> or <body>....</body> tags. - It doesn't need them.
Instead, 'default.aspx' has a set of 'asp:Content' tags and all of the pages 'content' goes in that
tagset. - You should by now see how simpler things begin to get.

This concept is really a godsend for us. - You set up things like loading css file(s), background color, etc. in
the master page and everything is consistent throughout the site. - You don't have to worry about keeping track of
any of that in your 'content' pages.
We could go on and on about the benefits of uisng master pages but in the interest of staying with our Login
Control series, we'll start here and move on.
|