Frameset vs. Masterpage

  • Thread starter Frank Milverckowitz
  • Start date
F

Frank Milverckowitz

Hi,

New to .NET... question about Masterpages vs. using Frameset

I'm using Visual Studio 2005 and notice that the generated pages are of
DTD/Doctype that don't support framesets. To use framesets I will be
changing all pages to HTML 4.0 loose.dtd.

I have a demand from my boss to use framesets to create a "keep-alive"
feature using a parent frame + ajax call on a time interval. (i.e. have the
xml http object call some page on the server just to keep the session
alive).

Should I be using Masterpages instead? I see that a masterpage "content
area" is mainly a <div> and that divs can contain a scrollbar. In addition
to my need for using AJAX from the masterpage, will a masterpage give me the
look and feel that a frameset might?


Thanks for any tips,
frank
 
K

Kevin Spencer

Hi Frank,

First, there is no reason you can't change the DOCTYPE of the pages that are
auto-generated in Visual Studio to XHTML 1.0 Frameset if you wish. However,
Framesets can be tricky in ASP.Net due to the different ways that browsers
handle Sessions in frames.

In addition, there is no reason that a "parent frame" should be necessary to
use Ajax for a keep-alive. Using MasterPages would certainly simplify the
process of adding your keep-alive Control to every page. In addition, it
allows you to use one or more layout templates that hold the major part of
the common page layout, removing the necessity to re-use common markup and
Controls in many pages, and removing that markup from the pages during the
development process.

So, yes, I would use MasterPages.

--
HTH,

Kevin Spencer
Microsoft MVP
Software Composer
http://unclechutney.blogspot.com

The shortest distance between 2 points is a curve.
 
M

Mark Rae

I'm using Visual Studio 2005 and notice that the generated pages are of
DTD/Doctype that don't support framesets. To use framesets I will be
changing all pages to HTML 4.0 loose.dtd.

Just change the DOCTYPE to XHTML 1.0 Frameset.
I have a demand from my boss to use framesets to create a "keep-alive"
feature using a parent frame + ajax call on a time interval. (i.e. have
the xml http object call some page on the server just to keep the session
alive).

Firstly, you certainly don't *need* to use frames for this - the whole point
of a MasterPage is that all content pages based on it share not only the
same look and feel but also any functionality contained within the
MasterPage.

In addition, lots of people will tell you frames are "bad" - in fact, I've
contracted at companies where they are expressely forbidden!
Should I be using Masterpages instead? I see that a masterpage "content
area" is mainly a <div> and that divs can contain a scrollbar. In addition
to my need for using AJAX from the masterpage, will a masterpage give me
the look and feel that a frameset might?

Yes indeed.

However, one word of caution - one of the most common mistakes people make
when first coming to MasterPages is to assume that they're somehow the
ASP.NET v2 equivalent of framesets - they aren't at all.

With a frameset, typically the header, footer and "menu" frame remain static
while the content is changed. With MasterPages, this is not the case at all.
In fact, once you realise that a MasterPage is actually not a page but a
UserControl, it becomes a lot clearer.

To move from the first content page to the second content page, you simply
redirect to the second content page which ASP.NET will construct by merging
the MasterPage (and any other UserControls) with the content page itself,
render the HTML and then stream it down to the client browser. The whole
page gets rebuilt every time because the MasterPage is just another
UserControl.
 

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

Members online

Forum statistics

Threads
473,994
Messages
2,570,222
Members
46,810
Latest member
Kassie0918

Latest Threads

Top