473,804 Members | 2,034 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 5143
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********@hotm ail.com
http://www.nathansokalski.com/

<go*******@gmai l.comwrote in message
news:2c******** *************** ***********@l76 g2000hse.google groups.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********@hotm ail.com
http://www.nathansokalski.com/

"bruce barker" <no****@nospam. comwrote in message
news:et******** ******@TK2MSFTN GP05.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*******@gmai l.comwrote in message
news:68******** *************** ***********@m74 g2000hsh.google groups.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**@markNOSPA Mrae.netwrote in message
news:%2******** ********@TK2MSF TNGP02.phx.gbl. ..
<go*******@gmai l.comwrote in message
news:68******** *************** ***********@m74 g2000hsh.google groups.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********@hot mail.comwrote in message
news:Of******** ******@TK2MSFTN GP02.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********@hotm ail.com
http://www.nathansokalski.com/

"bruce barker" <no****@nospam. comwrote in message
news:et******** ******@TK2MSFTN GP05.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******** ******@TK2MSFTN GP05.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

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

Similar topics

2
13278
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. I went ahead and wrote my own bit of code so I'm sharing it here for everyone. Even though it doesn't really disable the button by greying it out, it prevents the multiple submissions which it what I was attempting to prevent all along. ...
3
10040
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 to return to each Postback URL, but rather only the initial page URL. Is there a way to prevent Postback URL's from being added to the browser's history list Thanks in advance for any help.
4
10020
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 then be passed back to the main form and populate a textbox. it works fine. but when i used master page for all my pages and i put the textbox inside the content , the calender pops up but when i select the date nothing happens .. the textbox was...
9
1915
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 class from a Page that uses the MasterPage. How do I do that? public partial class List : System.Web.UI.MasterPage { protected ArrayList m_SortList;
0
1090
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 added a members-only section where I want to use a second masterpage, and am now having trouble. My member-startpage contains: A WebPartManager and 1 WebPartzone, with 3 gridviews each connected to a
3
2092
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, for example, that the Page_Load on the specific page executes before the Page_Load of its MasterPage. Is this right? But what I really want to understand is VARIABLE SCOPE, etc. between the two. For example: Is there a way for me to write code...
11
4257
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. How I stop the buttons from posting back when they are clicked? Thanks
3
3943
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 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...
1
6915
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 Page_Load(object sender, EventArgs e) { this.Master.HeadingLabel.Text = "Direct 4506 Purchase"; <--this gets the cast exception
0
9711
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
1
10331
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10087
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9166
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6861
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5529
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5667
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3831
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3001
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.