javascript to call on MasterPage onload

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 !
 
B

bruce barker

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)
 
F

faraz

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?...
 
G

Guest

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
/// ------------------------------
 
F

faraz

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. :)
 

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

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,020
Latest member
GenesisGai

Latest Threads

Top