473,387 Members | 1,745 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

How to prevent MasterPage post back

Hi,
Simply put, I have a control in MasterPage and another in content.
When the control in content fires off post back, MasterPage also runs
and returns post back. I want to control these where post back
happens in respected area, within content or within MasterPage. What
will be the simplest and logical way to implement this? TIA.
Sep 30 '08 #1
10 5109
When a postback occurs, the Init and Load events for both the Master Page
and the Content Page will be triggered. What, where, and when specifically
is it that you want to prevent code from being executed? Until you give more
detail on what you are trying to do, I'm not sure if anyone will be able to
help you.
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/

<go*******@gmail.comwrote in message
news:2c**********************************@l76g2000 hse.googlegroups.com...
Hi,
Simply put, I have a control in MasterPage and another in content.
When the control in content fires off post back, MasterPage also runs
and returns post back. I want to control these where post back
happens in respected area, within content or within MasterPage. What
will be the simplest and logical way to implement this? TIA.

Sep 30 '08 #2
the master page is just another control on the page that uses it, its
not a separate page.

-- bruce (sqlwork.com)

go*******@gmail.com wrote:
Hi,
Simply put, I have a control in MasterPage and another in content.
When the control in content fires off post back, MasterPage also runs
and returns post back. I want to control these where post back
happens in respected area, within content or within MasterPage. What
will be the simplest and logical way to implement this? TIA.
Oct 1 '08 #3
That is a good point as well, a page that gives a good explanation of the
relationship between Content and Master Pages is:

http://www.odetocode.com/Articles/450.aspx

--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/

"bruce barker" <no****@nospam.comwrote in message
news:et**************@TK2MSFTNGP05.phx.gbl...
the master page is just another control on the page that uses it, its not
a separate page.

-- bruce (sqlwork.com)

go*******@gmail.com wrote:
>Hi,
Simply put, I have a control in MasterPage and another in content.
When the control in content fires off post back, MasterPage also runs
and returns post back. I want to control these where post back
happens in respected area, within content or within MasterPage. What
will be the simplest and logical way to implement this? TIA.

Oct 1 '08 #4
Thanks for reply. So I have a button with a textbox for submit in
MasterPage, like search feature. I also have similar setting in
Content but for to submit something else for postback action. User
sees both inputs. However, user may select to click one in MasterPage
but Content Also fires off and gets undesired result there. Vice
versa occurs when Content fires off and MasterPage also reacts. Ideal
solution would be to isolate both world. I hope I describe enough. I
apprieciate your reply and let me know if I need to clarify further.
Thanks.
Oct 1 '08 #5
Page_Load is the place where I would like to isolate the action,
either by bypassing the event or within this method to detect and skip
the most of logic there.
Oct 1 '08 #6
<go*******@gmail.comwrote in message
news:68**********************************@m74g2000 hsh.googlegroups.com...
Page_Load is the place where I would like to isolate the action,
either by bypassing the event or within this method to detect and skip
the most of logic there.
As Bruce has explained, a MasterPage is nothing more than a special type of
UserControl. As such, it is fairly simple for a content page to communicate
with its MasterPage control, and vice versa, by defining properties and
setting their values:
http://www.google.co.uk/search?sourc...ontent+page%22

In addition, it is possible to capture whether the page is being loaded
"first time" as it were, or as the result of a postback:

if (!IsPostback)
{
// this code runs first time
}
else
{
// this code runs on postback
}
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Oct 1 '08 #7
I warned bruce and Nathan you might be hunting them down to warn them not to
top post. Thought I'd save you some time so you could focus on your real
value to us all..

"Mark Rae [MVP]" <ma**@markNOSPAMrae.netwrote in message
news:%2****************@TK2MSFTNGP02.phx.gbl...
<go*******@gmail.comwrote in message
news:68**********************************@m74g2000 hsh.googlegroups.com...
>Page_Load is the place where I would like to isolate the action,
either by bypassing the event or within this method to detect and skip
the most of logic there.

As Bruce has explained, a MasterPage is nothing more than a special type
of UserControl. As such, it is fairly simple for a content page to
communicate with its MasterPage control, and vice versa, by defining
properties and setting their values:
http://www.google.co.uk/search?sourc...ontent+page%22

In addition, it is possible to capture whether the page is being loaded
"first time" as it were, or as the result of a postback:

if (!IsPostback)
{
// this code runs first time
}
else
{
// this code runs on postback
}
--
Mark Rae
ASP.NET MVP
http://www.markrae.net
Oct 1 '08 #8
Better be careful, Mark Rae will hunt you down and scold you for top posting
:-0
"Nathan Sokalski" <nj********@hotmail.comwrote in message
news:Of**************@TK2MSFTNGP02.phx.gbl...
That is a good point as well, a page that gives a good explanation of the
relationship between Content and Master Pages is:

http://www.odetocode.com/Articles/450.aspx

--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/

"bruce barker" <no****@nospam.comwrote in message
news:et**************@TK2MSFTNGP05.phx.gbl...
>the master page is just another control on the page that uses it, its not
a separate page.

-- bruce (sqlwork.com)

go*******@gmail.com wrote:
>>Hi,
Simply put, I have a control in MasterPage and another in content.
When the control in content fires off post back, MasterPage also runs
and returns post back. I want to control these where post back
happens in respected area, within content or within MasterPage. What
will be the simplest and logical way to implement this? TIA.

Oct 1 '08 #9
Better be careful, Mark Rae will hunt you down and scold you for top posting
:-0
"bruce barker" <no****@nospam.comwrote in message
news:et**************@TK2MSFTNGP05.phx.gbl...
the master page is just another control on the page that uses it, its not
a separate page.

-- bruce (sqlwork.com)

go*******@gmail.com wrote:
>Hi,
Simply put, I have a control in MasterPage and another in content.
When the control in content fires off post back, MasterPage also runs
and returns post back. I want to control these where post back
happens in respected area, within content or within MasterPage. What
will be the simplest and logical way to implement this? TIA.
Oct 1 '08 #10
Yes, I already have IsPostBack check in my Page_Load. I just can't
tell if the postback occurred because of button in MasterPage or
button in Content. Let me go through the links given and do some
reading. Thanks a bunch.
Oct 1 '08 #11

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: techfuzz | last post by:
I scoured this group and others looking for the best way to disable a button after the first click to prevent multiple submissions, but never did find anything that worked like they said it would. ...
3
by: Rob | last post by:
Each time a webform is posted back (submitted), another URL is added to the browser's history list. My web application allows a back button to return to previously visited pages, but I do not wish...
4
by: Ali | last post by:
i am using visual studio 2005 and I am trying to create a popup calender so when a user click on a image on the main form, a calender will then popup, the user will select a date and the date will...
9
by: User | last post by:
OK, I asked in a reply, but I've wasted far too long so I'm going to put a new post out there in hopes that it will be more visible. I have a MasterPage. I want to call a method declared in that...
0
by: Herman verschooten | last post by:
Hi, I am creating my first real ASP.NET 2.0 site and want to use the some of the new features. I created a masterpage with my main layout and added several contentpages, no problem so far. I...
3
by: Alex Maghen | last post by:
Hi. I'm a little confused about the code that resides in the code-behind of a MasterPage and the code that resides in the code-behind of the actual pages that USE that MasterPage. I'm noticing,...
11
by: bill | last post by:
I dynamically create buttons and associate them with an event using AddHandler. I want all the button events to fire at one time, when the page is posted, instead of when each button is clicked....
3
by: Tom | last post by:
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...
1
by: GaryDean | last post by:
"Unable to cast object of type 'ASP.masterpage_master' to type 'MasterPage" This code has always worked but today it is getting the exception in the subject line of this post... protected void...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.