Load .js and .css files into custom user control
Hello
I have a problem when trying to add some JavaScript libraries and CSS files into my ascx control. Using the classic declarations <script src="" type="text/javascript" /> or using
<sf:ResourceLinks ID="resourceLinks" runat="server">
<sf:ResourceFile Name="~/Application/Backend/Content/js/jValidateForm.min.1.0.js" />
</sf:ResourceLinks>
doesn't work.
My path to the js is root/Application/Backend/Content/js.
Thank you
Hi,
Load jquery or other scripts either from embedded resources or relative path is using javascriptembedcontrol.
<%@ Register TagPrefix="sf" Assembly="Telerik.Sitefinity" Namespace="Telerik.Sitefinity.Web.UI" %>
<
sf:JavaScriptEmbedControl
runat
=
"server"
ID
=
"jQueryLink"
ScriptEmbedPosition
=
"Head"
</
sf:JavaScriptEmbedControl
>
<
sf:JavaScriptEmbedControl
runat
=
"server"
ID
=
"jQueryUILink"
ScriptEmbedPosition
=
"Head"
</
sf:JavaScriptEmbedControl
>
<
sf:JavaScriptEmbedControl
runat
=
"server"
ID
=
"JavaScriptEmbedControl6"
Url
=
"~/RTC_Scripts/series.js"
ScriptEmbedPosition
=
"Head"
>
</
sf:JavaScriptEmbedControl
>
<
sf:JavaScriptEmbedControl
runat
=
"server"
ID
=
"JavaScriptEmbedControl5"
Url
=
"~/RTC_Scripts/jquery.anythingslider.js"
ScriptEmbedPosition
=
"Head"
>
</
sf:JavaScriptEmbedControl
>
Hello,
Here is the correct assembly:
<%@ Register Namespace="Telerik.Sitefinity.Web.UI.PublicControls" Assembly="Telerik.Sitefinity" TagPrefix="sf" %>
Problem solved. Thank you