RadControls for ASP.NET AJAX
This topic shows how to register scripts using the dnn ScriptManager from a dnn module. One application of this technique is disabling embedded resources of Telerik controls which are used in a dnn module.
The twist with this approach is accessing the ScriptManager in the Page Load event handler of the user control of the dnn module. This is achieved via the dnn AJAX provider.
The code below registers the scripts needed for RadTabStrip when EnableEmbeddedScripts="false" for the control.
CopyC#
protected void Page_Load(object sender, System.EventArgs e)
{
ScriptManager ScriptManager1 = AJAX.ScriptManagerControl(Page);
ScriptReference sr1 = new ScriptReference();
sr1.Path = "~/DesktopModules/RadControls/Scripts/Common/Core.js";
ScriptReference sr2 = new ScriptReference();
sr2.Path = "~/DesktopModules/RadControls/Scripts/Common/Scrolling/ScrollingScripts.js";
ScriptReference sr3 = new ScriptReference();
sr3.Path = "~/DesktopModules/RadControls/Scripts/Common/Navigation/NavigationScripts.js";
ScriptReference sr4 = new ScriptReference();
sr4.Path = "~/DesktopModules/RadControls/Scripts/TabStrip/RadTabStripScripts.js";
ScriptManager1.Scripts.Add(sr1);
ScriptManager1.Scripts.Add(sr2);
ScriptManager1.Scripts.Add(sr3);
ScriptManager1.Scripts.Add(sr4);
}
CopyVB.NET
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim ScriptManager1 As ScriptManager = AJAX.ScriptManagerControl(Page)
Dim sr1 As New ScriptReference()
sr1.Path = "~/DesktopModules/RadControls/Scripts/Common/Core.js"
Dim sr2 As New ScriptReference()
sr2.Path = "~/DesktopModules/RadControls/Scripts/Common/Scrolling/ScrollingScripts.js"
Dim sr3 As New ScriptReference()
sr3.Path = "~/DesktopModules/RadControls/Scripts/Common/Navigation/NavigationScripts.js"
Dim sr4 As New ScriptReference()
sr4.Path = "~/DesktopModules/RadControls/Scripts/TabStrip/RadTabStripScripts.js"
ScriptManager1.Scripts.Add(sr1)
ScriptManager1.Scripts.Add(sr2)
ScriptManager1.Scripts.Add(sr3)
ScriptManager1.Scripts.Add(sr4)
End Sub