.NET 2.0 Master Pages and ClientScript

J

Jeremy McPeak

Howdy.

First of all, awesome job on .NET 2.0! Now to my question:

I love Master Pages and the Page.ClientScript; however, I am having trouble
getting the two to play together. I can build a simple .aspx page (no master
page) and add in JavaScript with RegisterClientScriptBlock() with no
problems. However, when I move the same code over to a content page (or a
master page), the client script is not added to the page. Are there other
steps required to get the two to play together? Is this working as intended,
or am I a moron? The code I'm using is simple:

string myScript = @"function doThis() { alert('Hello, World!');} doThis();
";

Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "myscript",
myScript, true);



Thanks!
 

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