Sometimes, we need to use pageLoad() function in both MasterPage and ContentPage to get something done. But, if we add two function with such same name, that function residing in ContentPage will be ignored by the browser. To correct this behavoiur, we need to extend pageLoad() functoin in MasterPage as follows:

In MasterPage

1
2
3
4
5
6
7
8
9
function pageLoad(sender, args)
{
...
// ... do my MasterPage JavaScript stuff...
...
if (window.contentPageLoad) {
window.contentPageLoad(sender, args);
}
}

In ContentPage

1
2
3
4
function contentPageLoad(sender, args)
{
// do something
}

Credit goes to devioblog.

No related posts.