Running jscript in initialization of ContentPlaceHolder

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi - We need to be able to invoke a child (contentplaceholder) page from a
master page and have the child run some jscript code in the initialization
event to load data specific to that child. We can't seem to find a way to do
it. The page.load event seems to be limited to the master page. How can we
do this on the child page?

Thanks for any help.
 
We need to be able to invoke a child (contentplaceholder) page from a
master page

MasterPages don't work like this - a MasterPage is nothing more than a
UserControl. You don't invoke the contentplaceholder from the MasterPage -
you open the page and it builds the MasterPage around itself...
 
So are you saying there is no way to run jscript on page initialization for
the contentplaceholder page?
 
So are you saying there is no way to run jscript on page initialization
for
the contentplaceholder page?


Apologies - when you said you wanted to "invoke" the page, I thought that's
what you meant...

You can run JavaScript from the page initialisation method of the
contentpage just like any other page...

private void Page_Init(object sender, System.EventArgs e)
{
ClientScript.RegisterStartupScript(GetType(), "Page_Init", "alert('Hello
from the content page');", true);
}
 
Back
Top