I was experimenting with the DragPanelExtender recently, and almost immediately ran into the question of how to position it upon opening.
There are a lot of articles to be found on this question, and they always deal with it by means of a JavaScript function called pageLoad(), which is called by the ASP.Net Ajax framework sometime while the page is loading.
Now my application already has a pageLoad() function in the MasterPage, so adding a function of the same name in the ContentPage just did not work, as it would not be called by the framework.
My knowledge of JavaScript is not too profound, and I found that a function definition in JavaScript is actually a property of the window object. The hint was a line in the MicrosoftAjax.js file:
if (window.pageLoad) window.pageLoad(this,a);
meaning: if there is a defined function named pageLoad(), it is a property of the window object, and the value of the property is not null (== not false), and I can call it.
The solution was clear to me soon: if I need a pageLoad() method in the ContentPage, I need to name it differently and check for its definition in the MasterPage.
The pageLoad() in the MasterPage looks like this:
function pageLoad(sender, args)
{
...
// ... do my MasterPage JavaScript stuff...
...
if (window.contentPageLoad) {
window.contentPageLoad(sender, args);
}
}
and the ContentPage has its equivalent contentPageLoad() function:
function contentPageLoad(sender, args)
{
// do something
}

[...] Read the original here: JavaScript pageLoad() for MasterPage and ContentPage « devioblog [...]
Thanks for the post. Thanks to your post I resolved a problem with multiple update panels in both MasterPage and conten pages.
I also want to thank you for this posting. It was a great help and something that I would surely not have figured out on my own!
Thanks for this post. It really works and saves my time.
[...] Credit goes to devioblog. [...]
Hi,
Thankyou for this post!
It’s worth noting that Web User Controls that have their own pageLoad() functions defined can cause this same behaviour (ie. pageLoad() in a normal ASP.Net page failing to be fired).
The solution is the same.. define a separate (differently named) function in your actual web page that is called by the pageLoad() function in your Web User Control.
[...] Credit goes to devioblog. [...]
You just saved me! Thanks!
thanks so much for this post really you saved my time
Amazing article….!…Too good…saves hell lot of time…
An alterantive and perhaps more scalable approach, if you’re using ASP.Net, is to register the startup script using ClientScript.RegisterStartupScript or ToolkitScriptManager).RegisterStartupScript, as described here:
http://stackoverflow.com/questions/988166/asp-net-ajax-multiple-pageload-functions-possible