javascript to call on MasterPage onload

  • Thread starter Thread starter faraz
  • Start date Start date
F

faraz

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 !
 
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)
 
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?...
 
You can define the script manager in your master page, then:

- Use the registerstartup script from script manager:

http://gotjeep.net/Blogs/CommentView,guid,4be2f278-12e4-40d5-b154-0e8ecaf18fac.aspx

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

http://aspalliance.com/1285_Tip_and_Tricks_ASPNET_20_AJAX_10_Extensions_and_Master_Pages

http://aspadvice.com/blogs/name/arc...erPage-ScriptManager-from-a-Content-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
/// ------------------------------
 
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. :)
 
Back
Top