views:

453

answers:

6

Hi

I'm learning ASP.NET using a great Sitepoint book, and I'm also learning more about CSS. I'm undecided on how useful Master Pages are. Could someone let me know whether the real world use mater pages - and if they don't what do they do?

Cheers Mike

+6  A: 

Yes, we absolutely use them. Typically you will use master pages to handle your header, footer and navigation sections that are consistent through-out all the pages in your website.

This follows the DRY principle of not having to repeat yourself when creating new web forms.

Andy Rose
+1  A: 

MasterPages are the best feature that came with ASP.NET 2.0.

I use them whenever I can. They simplify your maintenance and management on a website. With a one change you can change whole site.

Canavar
A: 

Hello Michael,

We use Masterpages for many of our applications and find them a benefit but I think your right to question how useful they are.

For our applications that have a large number of pages it's great to be able to extract a lot of the style information to one place. I know it's possible with include files etc but as Masterpages are the main method for Visual Studio it's obviously integrated very well and easy to use.

The biggest benefit for me is that I tend to use the same Masterpage across many applications thus giving them all the same look and feel. Again I know this can be achieved in other ways but it's Visual Studio integration makes it the easiest for us.

I think the best way for you to decide is to try them and try an alternative method as well. Pick your favorite and then let us all know!

David A Gibson
A: 

Master pages are absolutley crucial to any ASP.Net application. They are the building blocks for your site.

And if you ever start looking at SharePoint they are the underpinning of all customisation and branding.

Why would you think otherwise? I am interested to know why you might not have thought them as useful.

Charlie
HiIt's just that they seem to tread on the toes of CSS (from a beginners point of view) and wondered if you really needed them if CSS could do a lot of it for you. It seems that master pages are another thing I need to read more into.Many thanks for your reply
Mike
If you have well structured and named stylesheets then they can complement CSS rather than tread on its toes. But I agree they can add another layer to the 'cascade'.
Charlie
A: 

I've had a solution delivered without master pages, and its a real pain trying to change the layout of the page, as each page has to be changed individually.

ck
+1  A: 

I always use master pages. It helps keep the code for each page less cluttered, and as previously stated, it lessens the need to repeat yourself.

Speaking of CSS, I use CSS to style the master pages, and set text formating "rules", while I usually end up styling graphics in each individual aspx/ascx-file. I find this less confusing, as you'll otherwise end up with one massive CSS-file - which is hard to keep structured - or a myriad of CSS-files - which often get hard to keep track of.

Marcus L