MasterPage

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a VS.NET 2005 WEB application where I place all of my common controls
(ie header, nav, footer) into a mater page template. Then all of my web forms
inherit from the mater page template. All is well.

In the code behind in my materpage I have tried to code the isPostBack and
the Page.Master.IsPostback. But no matter which method I try, the Postback
returned is always false and my master page loads during each pstback.

Is there a different appraoch or am I missing something here?

Tom

PS I'm using asp.net 2.0 and VS.net 2005 on Windows 2003 server.
 
a MasterPage is really nothing more than another control - it just integrates
with the Page that specifies it and the result is the page gets all the
"Window dressing" that the MasterPage provides. So, it kind of doesn't make
sense to be looking for a postback in the MasterPage - the postback occurs in
the Page class that uses the MasterPage. What is the actual goal here?
Hope that makes sense.
Peter
 
Peter:

Thanks for replying and while I understadn better now, can you explain why
in VS.NET when I set a break point in the MasterPage.PageLoad(), then it
fires during postback? Or better yet, how do I control, not calling the code
during a post back?

Thanks

Tom
 
Tom,
I think you should experiment with the following pattern both in the Page
and in the MasterPage, with a breakpoint on each, so you can easily determing
what it is you are looking to do:

Page_Load (....
{

if(IsPostBack)
{

// your breakpoint and test code here

}

}


-- Peter
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com
 

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

Back
Top