New to Javascript in ASP.Net

  • Thread starter Thread starter Dave
  • Start date Start date
D

Dave

I have a web page that I'm trying to lauch another page in the same
web using window.open. Setting up the Javascript on a single page
isn't the issue. Where do I place the function when I'm using a
master page?
 
I have a web page that I'm trying to lauch another page in the same
web using window.open.  Setting up the Javascript on a single page
isn't the issue.  Where do I place the function when I'm using a
master page?

Dave, if you need to call it on startup then you can use
RegisterStartupScript to add your script from the content page

protected void Page_Load(object sender, EventArgs e)
{
const string someScript = "alertMe";
if (!ClientScript.IsStartupScriptRegistered(this.GetType(),
someScript))
{
ClientScript.RegisterStartupScript(this.GetType(),
someScript, "alert('I was called from Content
page!')", true);
}
}
 
Back
Top