JavaScriptEmbedControl
Hi,
I want to use the JavascriptEmbedControl but I need to use it programmatically rather than in the markup as I have some custom/inline js.
At what point in the page cycle can I add it to the page? I have tried:
protected
override
void
OnPreRender(EventArgs e)
JavaScriptEmbedControl jsControl =
new
JavaScriptEmbedControl();
jsControl.ScriptEmbedPosition = Telerik.Sitefinity.Web.UI.PublicControls.Enums.ScriptEmbedPosition.BeforeBodyEndTag;
jsControl.Url =
this
.Page.ClientScript.GetWebResourceUrl(
typeof
(SitefinityResources.Load),
"SitefinityResources.Resources.Js.jquery.easing-1.3.pack.js"
);
this
.Page.Controls.Add(jsControl);
Hello higgsy,
OnPreRender
is too late to add contorls to the page (as the error exception informs you). Please try adding the script on PageLoad() and inform me if you need any further assistance.
Greetings,
Boyan Barnev
the Telerik team