Newbie question about master page

C

ckerns

I am building my first site with a master page (first time using
VS2005) and several content pages and I have a dumb question .

What determines which content page is displayed when the page first
loads? How do I set this?

tia

ck
 
E

Eliyahu Goldin

In run time a master page doesn't have any separate existence. It is just a
part of another page, similar to a user control. So you don't display a
master page. You display a page that includes the master page.

--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net
 
M

Mark Rae

I am building my first site with a master page (first time using
VS2005) and several content pages and I have a dumb question .

What determines which content page is displayed when the page first
loads? How do I set this?

The biggest misconception about MasterPages is that they are somehow the
ASP.NET equivalent of framesets - they aren't at all.

In fact, a MasterPage is nothing more than a UserControl.

The MasterPage doesn't control which content page to display - it's the
other way round.

In order to display a content page, you navigate to it just like you would a
normal page e.g. Response.Redirect("MyContentPage.aspx") - the content page
knows which MasterPage to use, and constructs itself accordingly...
 
C

ckerns

I understand this. But what determines what is the first content page
to be displayed when site is loaded?
 
M

Mark Rae

I understand this. But what determines what is the first content page
to be displayed when site is loaded?

Whatever page you have designated as your site's startup page. Typically,
this would be default.aspx in the root of the virtual directory, but it
doesn't have to be...

If your startup page is a content page, then it will load its associated
MasterPage.

As Eliyahu says, this has nothing to do with content pages / MasterPages per
se...
 
C

ckerns

My site has a default.aspx, master.aspx, and six content pages.

When the site loads, it loads the default page which in turns fires
the master page. What determines which content page is displayed
first.
 
M

Mark Rae

My site has a default.aspx, master.aspx, and six content pages.

When the site loads, it loads the default page which in turns fires
the master page. What determines which content page is displayed
first.

See my earlier reply...

default.aspx is one of the standard startup pages on IIS sites so, unless
you've modified this, this will almost certainly be your site's startup
page.

In default.aspx, simply redirect to the content page you want to display
first...
 
E

Eliyahu Goldin

In default.aspx, simply redirect to the content page you want to display

Just to make it clear. The whole discussion was around this point. Open a
content page, not the master one.

--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net


Mark Rae said:
My site has a default.aspx, master.aspx, and six content pages.

When the site loads, it loads the default page which in turns fires
the master page. What determines which content page is displayed
first.

See my earlier reply...

default.aspx is one of the standard startup pages on IIS sites so, unless
you've modified this, this will almost certainly be your site's startup
page.

In default.aspx, simply redirect to the content page you want to display
first...
[/QUOTE]
 

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,774
Messages
2,569,598
Members
45,158
Latest member
Vinay_Kumar Nevatia
Top