masterpages vs. CSS or Masterpages with CSS??? help me out please!

N

Nick Wouters

Dear All

In Classic ASP I used CSS for ALL layout.
Now in ASP.NET version 2 I am testing out Masterpages as they come in very
handy.

It seems like it is replacing CSS for layout but what is the best choise?

1) Using Masterpages with Themes (css / images / skins included in this
theme)
2) Using only CSS (because I see at this moment no advantage of masterpages
against css)
3) Using Masterpages only

Please help me out, I am an expierend ASP classic writer, but I am using
ASP.NET for the first week and I am still confused

Thanks in advance...

Nick Wouters
 
F

Flinky Wisty Pomm

I don't see that Masterpages/CSS have any overlap - the former are
chunks of content that you want on each page with space left for page
specific content. I use MasterPages to set up my basic page structure,
insert content with a contentholder, and style everything with CSS.
 
N

Nick Wouters

With CSS you can also make parts with <DIV></DIV>

You are probebly right, maybe you do not understand my confusion?

Thanks

Nick
 
F

Flinky Wisty Pomm

You can't make parts with CSS... You can style them.

You could have a MasterPage containing

<div id="mainBody>
<asp:ContentHolder id="stuff" runat="server" />
</div>

<div id="leftMenu">
<asp:Repeater id="leftMenuLinks">
... unordered list of links here ..
</asp:Repeater>
</div>

That'll give you a plain ol' HTML document, your menu links are on the
master page so they can appear on each page which uses that master, as
is your main content DIV.

You can layout/style that with CSS just as you would an ASP classic
page. What am I missing?
 
N

Nick Wouters

In Classic ASP you would also do like this

<DIV id="mainBody">
bla bla bla
</DIV>

and the menu

<DIV ID="leftmenu">
<a href="link1.asp">link1</a>
<a href="link2.asp">link2</a>
</DIV>

and in your CSS file you say that the menu is at the left (margin : 0) and
the mainbody has margin 200px for example
Each new page you make a new DIV with the same ID="leftmenu" and
ID="mainBody"
It is just a few lines more code but I am working withouth masterpages then,
can you tell me the Main advantages of Masterpages please
because I don't see any BIG advantage at this time.

Sorry to trouble you with this strange question...

Thanks in advance

Nick
 
F

Flinky Wisty Pomm

In classic asp, it's common to put headers/footers etc into include
files and to stick those at the top of your pages so that you can have
the common HTML in a single place.

MasterPages allow you to keep the common structural code for your pages
in one place. Think of them as templates, if you need to change that
structural code there is only one place to do it. You can handle events
for UI navigation and things inside your MasterPage so that you don't
need to duplicate that either. It's just good practice, keep common
code in a single place and it's easier to manage.
 

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