New to Javascript in ASP.Net

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?
 
A

Alexey Smirnov

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);
}
}
 

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

Top