471,092 Members | 1,919 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

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

javascript to call on MasterPage onload

I have a javascript function that i want to call masterpage load
method called. I cant add onLoad event of body or table in master
page.

I have put the call to script function in <form>, it works on every
pageLoad. seems my problem is solved. But when the pages uses
UpdatePanel and it gets asynchronously postback. the function call at
master page doesnt execute????? thought master page Load event gets
called even when pages are in updatePanel.

I want the particular function to be executed on every postback by
updatePanel.?/??

how can i do this..??

thanks for replies in advance.. it is urgent !

Nov 7 '07 #1
4 12922
on an async postback, only script registered in the update panel will be
executed. if you want to run on an async postback, then the update panel
should register a call to the function. also only script registered with
the ajax script manager will sent to the client and executed.

-- bruce (sqlwork.com)

faraz wrote:
I have a javascript function that i want to call masterpage load
method called. I cant add onLoad event of body or table in master
page.

I have put the call to script function in <form>, it works on every
pageLoad. seems my problem is solved. But when the pages uses
UpdatePanel and it gets asynchronously postback. the function call at
master page doesnt execute????? thought master page Load event gets
called even when pages are in updatePanel.

I want the particular function to be executed on every postback by
updatePanel.?/??

how can i do this..??

thanks for replies in advance.. it is urgent !
Nov 7 '07 #2
thanks for the reply.. i was wondering how would i attach the script
function call (function is in master page) with UpdatePanel of Page?..
and is there anything i can only with master page and have it on all
pages?...

Nov 7 '07 #3
You can define the script manager in your master page, then:

- Use the registerstartup script from script manager:

http://gotjeep.net/Blogs/CommentView...ecaf18fac.aspx

- If you want to call script manager from child pages or user controls use
the scriptmanagerproxy:

http://aspalliance.com/1285_Tip_and_...d_Master_Pages

http://aspadvice.com/blogs/name/arch...tent-Page.aspx
- If you want to launch some javascript after an update panel updates,
AJAX ASP .net expose some events for that, check out EndRequest event.

/// ------------------------------
/// Braulio Diez
///
/// http://www.tipsdotnet.com
/// ------------------------------


"faraz" wrote:
I have a javascript function that i want to call masterpage load
method called. I cant add onLoad event of body or table in master
page.

I have put the call to script function in <form>, it works on every
pageLoad. seems my problem is solved. But when the pages uses
UpdatePanel and it gets asynchronously postback. the function call at
master page doesnt execute????? thought master page Load event gets
called even when pages are in updatePanel.

I want the particular function to be executed on every postback by
updatePanel.?/??

how can i do this..??

thanks for replies in advance.. it is urgent !

Nov 7 '07 #4
thanks alot guys..EndRequest Event works ! .. I dont even have to
register the script with scriptManager. I just had to call the my
function in the UpdatePanel through EndRequest event.

thanks for such quick response. :)

Nov 7 '07 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Daves | last post: by
3 posts views Thread by Daves | last post: by
4 posts views Thread by E | last post: by
8 posts views Thread by Frank | last post: by
2 posts views Thread by Kees de Winter | last post: by
5 posts views Thread by =?Utf-8?B?TWF0Y29u?= | last post: by

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.