I had a little problem and worked a bit, but struggled to come up with a final answer / fix.
Basically, I have javascript (created by a third party) that does some whizzbang elements for page elements to make them look beautiful. This code works fine on separate pages (i.e. there is no wizard), however, when I try to apply effects to the content page inside the wizard, this will not work.
In short, I have a main page containing the main script link. All pages will use the script, but the parameters passed to it will be different for content pages.
Master page script link
<script src="scripts.js" language="javascript" type="text/javascript" />
Single page
<script>
MakePretty("elementID");
</script>
As you can see, I need a link on every page (therefore, it is in the main page), but the actual elements that I want to "MakePretty" will vary depending on the content.
Content Pages
Now, due to the fact that the content page does not have an element <head>, I used the following code to add it to the master pages <head>:
HtmlGenericControl ctl = new HtmlGenericControl("script");
ctl.Attributes.Add("language", "javascript");
ctl.InnerHtml = @"MakePretty(""elementID"")";
Master.Page.Header.Controls.Add(ctl);
Now this one does not work . However, if I replace something simple, like alert("HI!"), everything works fine. Thus, the code is added OK, it just does not always execute, depending on what it does.
, , , content content Load , , , javascript / ?
, , - javascript, .
javascript, ?
/ , .
:
RegisterStartupScript .., , .- , MasterPage, , .
, - , , , , /.