473,394 Members | 1,769 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,394 software developers and data experts.

Any way to remove all Page.Load event handlers?

We're creating several different websites all based on a common framework,
including a base page from which all pages inherit. This page is responsible
for rendering the page layout, etc.

I'm implementing a bit of functionality that reads an XML file for scheduled
website downtimes; if there is a current downtime entry, the parent page
removes any and all child controls that have been added by the child page,
and presents a few literal controls explaining the situation.

The problem: load handlers attached by the child page still fire. (As well
they should.) In many cases, these handlers do the sorts of things that
will cause problems during downtimes, such as trying to connect to a
database. I'd like to know if there's a way to programatically remove load
handlers added by the child page from within the parent page.

There are other solutions I can think of, such as doing a redirect to a
notification page, but I'd like to handle it all within the purview of the
parent page if at all possible.

Thanks!
Nov 18 '05 #1
4 1773
Hi, Matthew Burnside,

You can set a boolean property in the base class and then just check it in
the child classes' methods. eg:

public class BasePage : Page
{
bool _dontProcess;

protected bool DontProcess
{
get{return _dontProcess;}
}

protected void Page_Load(object s, EventArgs e)
{
if(something){
_dontProcess = true;
HideControls(); // etc......
return;
}
}
}

public class SomePage : BasePage
{
protected void Page_Load(object s, EventArgs e)
{
if(base.DontProcess)
return;
// continue normally
}
protected void SomeButton_Click(object s, EventArgs e)
{
if(base.DontProcess)
return;
// continue normally
}
}

Hope this helps
Martin
"Matthew Burnside" <ma**********@NOsbcSPAMglobalPLEASE.net> wrote in message
news:Fk*****************@newssvr23.news.prodigy.co m...
We're creating several different websites all based on a common framework,
including a base page from which all pages inherit. This page is responsible for rendering the page layout, etc.

I'm implementing a bit of functionality that reads an XML file for scheduled website downtimes; if there is a current downtime entry, the parent page
removes any and all child controls that have been added by the child page,
and presents a few literal controls explaining the situation.

The problem: load handlers attached by the child page still fire. (As well
they should.) In many cases, these handlers do the sorts of things that
will cause problems during downtimes, such as trying to connect to a
database. I'd like to know if there's a way to programatically remove load
handlers added by the child page from within the parent page.

There are other solutions I can think of, such as doing a redirect to a
notification page, but I'd like to handle it all within the purview of the
parent page if at all possible.

Thanks!


Nov 18 '05 #2
Yeah, I had considered that, but I'm trying to insulate the developers of
the child pages from having to be aware of this, and I'm worried that even
if they know about it they won't apply it consistently.

OTOH, it may be the only way. Thanks for responding.

"Martin Dechev" <de*******@hotmail.com> wrote in message
news:O%****************@TK2MSFTNGP10.phx.gbl...
Hi, Matthew Burnside,

You can set a boolean property in the base class and then just check it in
the child classes' methods. eg:

public class BasePage : Page
{
bool _dontProcess;

protected bool DontProcess
{
get{return _dontProcess;}
}

protected void Page_Load(object s, EventArgs e)
{
if(something){
_dontProcess = true;
HideControls(); // etc......
return;
}
}
}

public class SomePage : BasePage
{
protected void Page_Load(object s, EventArgs e)
{
if(base.DontProcess)
return;
// continue normally
}
protected void SomeButton_Click(object s, EventArgs e)
{
if(base.DontProcess)
return;
// continue normally
}
}

Hope this helps
Martin
"Matthew Burnside" <ma**********@NOsbcSPAMglobalPLEASE.net> wrote in message news:Fk*****************@newssvr23.news.prodigy.co m...
We're creating several different websites all based on a common framework, including a base page from which all pages inherit. This page is

responsible
for rendering the page layout, etc.

I'm implementing a bit of functionality that reads an XML file for

scheduled
website downtimes; if there is a current downtime entry, the parent page
removes any and all child controls that have been added by the child page, and presents a few literal controls explaining the situation.

The problem: load handlers attached by the child page still fire. (As well they should.) In many cases, these handlers do the sorts of things that
will cause problems during downtimes, such as trying to connect to a
database. I'd like to know if there's a way to programatically remove load handlers added by the child page from within the parent page.

There are other solutions I can think of, such as doing a redirect to a
notification page, but I'd like to handle it all within the purview of the parent page if at all possible.

Thanks!

Nov 18 '05 #3
Alternatively, you can response some html and call Response.End() - it will
interrupt the code execution.

Greetings
Martin
"Matthew Burnside" <ma**********@NOsbcSPAMglobalPLEASE.net> wrote in message
news:zc****************@newssvr23.news.prodigy.com ...
Yeah, I had considered that, but I'm trying to insulate the developers of
the child pages from having to be aware of this, and I'm worried that even
if they know about it they won't apply it consistently.

OTOH, it may be the only way. Thanks for responding.

"Martin Dechev" <de*******@hotmail.com> wrote in message
news:O%****************@TK2MSFTNGP10.phx.gbl...
Hi, Matthew Burnside,

You can set a boolean property in the base class and then just check it in
the child classes' methods. eg:

public class BasePage : Page
{
bool _dontProcess;

protected bool DontProcess
{
get{return _dontProcess;}
}

protected void Page_Load(object s, EventArgs e)
{
if(something){
_dontProcess = true;
HideControls(); // etc......
return;
}
}
}

public class SomePage : BasePage
{
protected void Page_Load(object s, EventArgs e)
{
if(base.DontProcess)
return;
// continue normally
}
protected void SomeButton_Click(object s, EventArgs e)
{
if(base.DontProcess)
return;
// continue normally
}
}

Hope this helps
Martin
"Matthew Burnside" <ma**********@NOsbcSPAMglobalPLEASE.net> wrote in

message
news:Fk*****************@newssvr23.news.prodigy.co m...
We're creating several different websites all based on a common

framework, including a base page from which all pages inherit. This page is

responsible
for rendering the page layout, etc.

I'm implementing a bit of functionality that reads an XML file for

scheduled
website downtimes; if there is a current downtime entry, the parent page removes any and all child controls that have been added by the child page, and presents a few literal controls explaining the situation.

The problem: load handlers attached by the child page still fire. (As well they should.) In many cases, these handlers do the sorts of things that will cause problems during downtimes, such as trying to connect to a
database. I'd like to know if there's a way to programatically remove load handlers added by the child page from within the parent page.

There are other solutions I can think of, such as doing a redirect to a notification page, but I'd like to handle it all within the purview of the parent page if at all possible.

Thanks!



Nov 18 '05 #4
Don't know why I didn't think of that; I'll see how it works within our
framework. Thanks.

"Martin Dechev" <de*******@hotmail.com> wrote in message
news:eo**************@TK2MSFTNGP09.phx.gbl...
Alternatively, you can response some html and call Response.End() - it will interrupt the code execution.

Greetings
Martin
"Matthew Burnside" <ma**********@NOsbcSPAMglobalPLEASE.net> wrote in message news:zc****************@newssvr23.news.prodigy.com ...
Yeah, I had considered that, but I'm trying to insulate the developers of
the child pages from having to be aware of this, and I'm worried that even if they know about it they won't apply it consistently.

OTOH, it may be the only way. Thanks for responding.

"Martin Dechev" <de*******@hotmail.com> wrote in message
news:O%****************@TK2MSFTNGP10.phx.gbl...
Hi, Matthew Burnside,

You can set a boolean property in the base class and then just check
it
in the child classes' methods. eg:

public class BasePage : Page
{
bool _dontProcess;

protected bool DontProcess
{
get{return _dontProcess;}
}

protected void Page_Load(object s, EventArgs e)
{
if(something){
_dontProcess = true;
HideControls(); // etc......
return;
}
}
}

public class SomePage : BasePage
{
protected void Page_Load(object s, EventArgs e)
{
if(base.DontProcess)
return;
// continue normally
}
protected void SomeButton_Click(object s, EventArgs e)
{
if(base.DontProcess)
return;
// continue normally
}
}

Hope this helps
Martin
"Matthew Burnside" <ma**********@NOsbcSPAMglobalPLEASE.net> wrote in message
news:Fk*****************@newssvr23.news.prodigy.co m...
> We're creating several different websites all based on a common

framework,
> including a base page from which all pages inherit. This page is
responsible
> for rendering the page layout, etc.
>
> I'm implementing a bit of functionality that reads an XML file for
scheduled
> website downtimes; if there is a current downtime entry, the parent page > removes any and all child controls that have been added by the child

page,
> and presents a few literal controls explaining the situation.
>
> The problem: load handlers attached by the child page still fire.
(As well
> they should.) In many cases, these handlers do the sorts of things that > will cause problems during downtimes, such as trying to connect to a
> database. I'd like to know if there's a way to programatically
remove load
> handlers added by the child page from within the parent page.
>
> There are other solutions I can think of, such as doing a redirect
to a > notification page, but I'd like to handle it all within the purview

of the
> parent page if at all possible.
>
> Thanks!
>
>


Nov 18 '05 #5

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

Similar topics

1
by: Greg | last post by:
In my ASP.NET application I have a button that when pressed, data needs to be saved based on what the user typed in. I have other controls on the same page that should be updated as a result of the...
2
by: John Lau | last post by:
Hi, Is there documentation that talks about the page lifecycle, the lifecycle of controls on the page, and the rendering of inline code, in a single document? Thanks, John
4
by: Christopher | last post by:
I am trying to load a UserControl which inherits from one of our customer classes which in turn inherits from UserControl. We use Page.LoadControl() from within our ASP.NET pages to load these...
1
by: seanmayhew | last post by:
I have a form page that that while editing saves the data to an xml doc before submitting to db. On each page unload it saves the xmldoc as the user can add multiple items to the company like...
8
by: MaryA | last post by:
I have an aspx page that loads twice inspite of using the IsPostBack i removed all controls from the page and still the page_load event is called twice I appriciate any help coz i have lost...
9
by: Charles Law | last post by:
I have a form on which user controls are placed at runtime. When a control is added to the form a handler is added for an event that a high-level object raises, which must be handled by the new...
1
by: weboweb | last post by:
Hello aspnet experts! I have a design question for the more experienced developers (more than me at least :-)). 1) I have a page in the application I'm building that displays a web user...
1
by: Christian Sengstock | last post by:
Hi all, i have a js application with several event handlers which i manage via prototype .bindAsEventListener. On normal page navigation ( link navigation ) i finish all events handlers...
2
by: Dinsdale | last post by:
I appreciate anyones help here. I've done a whole ton of cool things in C# and am having difficulty expressing those things in VB. In a program I wrote in C# (which I no longer have source for) I...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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...
0
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...

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.