master pages - is it just me not comfortable with them?

O

oliharvey

I'm an experienced web developer - but haven't used master pages much.

I find that I'm not really comfortable with them - so perhaps I'm
missing something.....

When I first read about them I was shocked that the content
placeholder pages need knowledge of which master page they were in -
I'm happier now I understand they can be set dynamically - but I still
can't help thinking that they provide nothing on top of a reasonable
page/usercontrol design ....

....in fact I prefer a design where there's only ever *one* aspx page
per site - and everything else is written as UserControls (probably
loaded dynamically with LoadControl)... this gives nice
componentisation and ultimate flexibility.

I tend to work in Enterprise environments.

....I'd appreciate any comments on this.

thanks,
O.
 
D

David Wier

I am very comfortable with them. In fact, I doubt that I would design
another site without them - - it's the quick and easy way for a consistent
look and feel - even nested, for, let's say, a company and it's departments
(especially since it's supported better with VS.Net 2008)

When you look at it - a Master page is pretty much the same as a
usercontrol - and it's referenced on each page, in the same way a user
control would be - and since, as you say, it can be set dynamically, just as
a user control would be, what's your root problem with them?

David Wier
http://aspnet101.com
http://iWritePro.com - One click PDF, convert .doc/.rtf/.txt to HTML with no
bloated markup
 
S

Scott Roberts

I'm an experienced web developer - but haven't used master pages much.

I find that I'm not really comfortable with them - so perhaps I'm
missing something.....

When I first read about them I was shocked that the content
placeholder pages need knowledge of which master page they were in -
I'm happier now I understand they can be set dynamically - but I still
can't help thinking that they provide nothing on top of a reasonable
page/usercontrol design ....

I tend to use them precisely for page design. IMO that's *is* their purpose.
...in fact I prefer a design where there's only ever *one* aspx page
per site - and everything else is written as UserControls (probably
loaded dynamically with LoadControl)... this gives nice
componentisation and ultimate flexibility.

I've had that thought too, but never pursued it. For something like a
web-mail client it might work.

It sounds like you might also be a fan of MVC. Check out the new MVC stuff
for asp.net.
http://weblogs.asp.net/scottgu/archive/2007/10/14/asp-net-mvc-framework.aspx
 
M

Mark Rae [MVP]

I'm totally comfortable with them to the extent where I doubt I'd ever
consider designing another web app without them...
...in fact I prefer a design where there's only ever *one* aspx page
per site - and everything else is written as UserControls (probably
loaded dynamically with LoadControl)... this gives nice
componentisation and ultimate flexibility.

A MasterPage is a UserControl...
 
G

George Ter-Saakov

Just my 2 cents.

1. Try to use master pages. You are going to love them. I have couple
internal rules for myself for any .NET project that I start and one of them
is "Always create and use MasterPage" even if it's empty...

2. Design when there is only one default.aspx page is workable. I actually
have developed E-commerce projects which has only on default.aspx (it's
completely functional and working, about 3 thousand visitors a day).

The only problem with this approach is that people love to have different
URLs. They like ability to add them to "My Favorites" or send a link to
their buddies in email...
So one page approach presents some challenges and usually needs a URL
rewriting.
Here is my site: http://www.mspiercing.com try to hit it. You will never
tell that in reality there is only one default.aspx page there.

But from my experience, unless you are developing "framework" like
DotNetNuke, the single page design is not worth all problems it creates in
most projects.
I do believe in nice structurization though. So forum aspx pages reside in
"forum" folder, picture gallery in "gallery" folder....


George.
 
Z

zzzxtreme

i never use them
i have base page class, and some other class that inherits it
so if i want my aspx page to load some particular template, i inherit
a particular class
i always use dynamic loading of asxc file, one header, and one footer.
after my client login, the pages inherits a different class.
so in the actual aspx code, i don't set any masterpage or include any
header/footer file.

i guess there's no wrong in using masterpages, but like you, im
uncomfortable with it.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top