Re: Master page postback.. !IsPostback doesnt work
- From: "Mark Rae [MVP]" <mark@xxxxxxxxxxxxxxxxx>
- Date: Mon, 9 Jul 2007 11:05:45 +0100
<anthonykallay@xxxxxxxxxxxxxx> wrote in message news:1183974859.523589.140810@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Hi there,
I dont this this a bug but i cant get my head around it.. I have a
master page that has a login control on it, to log in i press the
button and the page posts back, however on the page that is derived
from the master page (default.aspx) i have code that i dont want to
run after the login button is pressed so i used the standard
if(!Page.IsPostBack) {}
to try and hide the code on default.aspx, however since the postbsck
comes from the control in the master page this code still runs???
How do i stop this code running in default.aspx whn the login button
in the aster page is clicked??
A couple of things...
Firstly, in the MasterPage / ContentPage scenario, content pages aren't "derived" from master pages - quite the reverse! In fact, a MasterPage is really nothing more than a UserControl.
Secondly, master pages are intended to provide common look and feel (and sometimes functionality) across several pages, possibly an entire site. If you have functionality in your master page which is intended for only one content page, then that functionality would be better placed in the content page itself, not the master page...
--
Mark Rae
ASP.NET MVP
http://www.markrae.net
.
- Follow-Ups:
- Re: Master page postback.. !IsPostback doesnt work
- From: anthonykallay
- Re: Master page postback.. !IsPostback doesnt work
- References:
- Master page postback.. !IsPostback doesnt work
- From: anthonykallay
- Master page postback.. !IsPostback doesnt work
- Prev by Date: Re: A bit of Architecture advice.. One code.. Multiple sites
- Next by Date: Creating db from SQL statements
- Previous by thread: Master page postback.. !IsPostback doesnt work
- Next by thread: Re: Master page postback.. !IsPostback doesnt work
- Index(es):