Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Timer on master page causes the child page to go through its page

Reply
Thread Tools

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

 
 
Luai24
Guest
Posts: n/a
 
      05-06-2009
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!
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Its a bird, its a plane, its.. um, an Attribute based System? thunk Ruby 14 04-03-2010 10:08 AM
Its a bird, its a plane, its.. um, an Attribute based System? thunk Ruby 0 04-01-2010 10:25 PM
Its a bird, its a plane, no ummm, its a Ruide thunk Ruby 1 03-30-2010 11:10 AM
seeking servlet "Master" keep getting "Master/servlet/Master" not found. Tomcat 5.0.25 Doug McCann Java 1 08-05-2004 09:16 PM
How do I: Main thread spawn child threads, which child processes...control those child processes? Jeff Rodriguez C Programming 23 12-09-2003 11:06 PM



Advertisments