Timer on master page causes the child page to go through its page

L

Luai24

I have a timer on my parent master page that checks for certain events and
updates controls that I want through an updatePanel.

I have numerous child pages that inherit from the master page.

I get the desired effect of the timer checking for some event and updating
the controls I specified.



The undesired effect is the timer will go through the selected(In View)
child page --- page life cycle.

So if I have a code in my Page_Init or
Page_Load event handlers whatever is in them gets executed.

Doesn't render the html because it is a call back and only updates the
control I specified like I wanted but, It seems unnessary that It goes
through the page lifecycle of the child page.

I do logging in the methods I have in some of these page life cycle stages
and If I happen to leave my user agent with a view of one of this pages, it
will be logging every interval that the timer is set to. That is not desired.

Here is a pseudo example

Master Page aspx = Timer set to interval 30 sec , And Update panel with
updatemode set to conditional

Master code behind = Page_load checkforEvent and if true update the panel.

******************************************************************************************************

Child page 1 inherits from Master page

Page load = Do something specific to the page and nothing to do with timer ,
by the way log what you do

**************************************************

Child Page 2 inherits from Master page

Page load = Do something specific to the page and nothing to do with
timer,by the way log what you do

********************************



My expected result is ,

Go through page load and other page life cycles of the of the master page
but not the children.

Apparently that is not the case.

Question is, How Can I stop the timer from firing my child page event
handlers??

The sender in the page load of the child says it is the child page not the
timer, so I cant say if timer skip what it usually does.

I also can't set a flag in the master page , like a session var to flag the
timer because in ASP.net the child fires before the Master.

This is all expected behaviour

One sugestion I had from asp.net forums was to use .....
if (! ScriptManager.IsInAsyncPostBack) {//call the function}
It would have been nice but my script manager is in the master page and it
returns true for every ajax request , regardless of who the trigger is.

So my code in child page_load never executes if I wrapped it with the "if"
above, since most of my pages are ajaxified.

What I really need is a way to know who the sender is, if it is the timer
then i can skip the code in my child page_load.

But the sender comes in as page itself, not the real sender which is the
timer. that might have to do with the fact that child page loads before
master.

How exactly can I tell the Timer (in the master) is the sender from my child
pages?

Thanx!
 

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

Members online

No members online now.

Forum statistics

Threads
473,968
Messages
2,570,152
Members
46,697
Latest member
AugustNabo

Latest Threads

Top