/// <summary> /// AddScriptManager is used internally by the framework to add a ScriptManager control to the page. /// </summary> /// <param name="page">the page instance.</param> /// <param name="checkCdn">Whether check cdn settings from host settings.</param> public static void AddScriptManager(Page page, bool checkCdn) { if (GetScriptManager(page) == null) { if (page.Form != null) { try { using (var scriptManager = new ScriptManager // RadScriptManager { ID = "ScriptManager", EnableScriptGlobalization = true, SupportsPartialRendering = true, }) { if (checkCdn) { scriptManager.EnableCdn = Host.EnableMsAjaxCdn; scriptManager.EnableCdnFallback = Host.EnableMsAjaxCdn; } page.Form.Controls.AddAt(0, scriptManager); } if (HttpContext.Current.Items["System.Web.UI.ScriptManager"] == null) { HttpContext.Current.Items.Add("System.Web.UI.ScriptManager", true); } } catch { // suppress error adding script manager to support edge-case of module developers custom aspx pages that inherit from basepage and use code blocks } } } }
/// <summary> /// AddScriptManager is used internally by the framework to add a ScriptManager control to the page. /// </summary> /// <param name="page">the page instance.</param> /// <param name="checkCdn">Whether check cdn settings from host settings.</param> public static void AddScriptManager(Page page, bool checkCdn) { if (GetScriptManager(page) == null) { if (page.Form != null) { try { using (var scriptManager = new ScriptManager // RadScriptManager { ID = "ScriptManager", EnableScriptGlobalization = true, SupportsPartialRendering = true, }) { if (checkCdn) { scriptManager.EnableCdn = Host.EnableMsAjaxCdn; scriptManager.EnableCdnFallback = Host.EnableMsAjaxCdn; } page.Form.Controls.AddAt(0, scriptManager); } if (HttpContext.Current.Items["System.Web.UI.ScriptManager"] == null) { HttpContext.Current.Items.Add("System.Web.UI.ScriptManager", true); } } catch { // suppress error adding script manager to support edge-case of module developers custom aspx pages that inherit from basepage and use code blocks } } if (page.Form != null) { try { // DNN-9145 TODO // using (var stylesheetManager = new RadStyleSheetManager { ID = "StylesheetManager", EnableHandlerDetection = false }) // { // if (checkCdn) // { // stylesheetManager.CdnSettings.TelerikCdn = Host.EnableTelerikCdn ? TelerikCdnMode.Enabled : TelerikCdnMode.Disabled; // if (stylesheetManager.CdnSettings.TelerikCdn != TelerikCdnMode.Disabled && !string.IsNullOrEmpty(Host.TelerikCdnBasicUrl)) // { // stylesheetManager.CdnSettings.BaseUrl = Host.TelerikCdnBasicUrl; // } // if (stylesheetManager.CdnSettings.TelerikCdn != TelerikCdnMode.Disabled && !string.IsNullOrEmpty(Host.TelerikCdnSecureUrl)) // { // stylesheetManager.CdnSettings.BaseSecureUrl = Host.TelerikCdnSecureUrl; // } // } // page.Form.Controls.AddAt(0, stylesheetManager); // } } catch { // suppress error adding script manager to support edge-case of module developers custom aspx pages that inherit from basepage and use code blocks } } } }