protected override void OnPreRender(EventArgs e) { base.OnPreRender(e); ClientScriptManager cs = Page.ClientScript; if (!cs.IsClientScriptIncludeRegistered("jquery.tmpl")) { cs.RegisterClientScriptInclude("jquery.tmpl", Globals.ResolveUrl("~/Resources/Shared/Scripts/jquery/jquery.tmpl.js")); } ; if (!cs.IsClientScriptIncludeRegistered("json2")) { cs.RegisterClientScriptInclude("json2", Globals.ResolveUrl("~/Resources/Shared/Scripts/json2.js")); } ; if (!cs.IsClientScriptIncludeRegistered("gallery")) { //if (IsDebugEnabled()) //{ cs.RegisterClientScriptInclude("gallery", Globals.ResolveUrl("~/DesktopModules/Admin/Extensions/Scripts/Gallery.js")); //} //else //{ // cs.RegisterClientScriptInclude("gallery", Globals.ResolveUrl("~/DesktopModules/Admin/Extensions/Scripts/Gallery-compiled.js")); //} } }
protected void Page_Load(object sender, EventArgs e) { //Always include the default theme Page.Header.Controls.Add(new LiteralControl("<link rel=\"stylesheet\" type=\"text/css\" href=\"" + ResolveUrl("~/App_Themes/Default/Default.css") + "\" />")); ClientScriptManager cs = Page.ClientScript; if (!cs.IsClientScriptIncludeRegistered("common")) { cs.RegisterClientScriptInclude("common", ResolveClientUrl("Scripts/common.js")); } if (!cs.IsClientScriptIncludeRegistered("jquery")) { cs.RegisterClientScriptInclude("jquery", ResolveClientUrl("Scripts/jquery-1.11.2.js")); } if (!cs.IsClientScriptIncludeRegistered("shell")) { cs.RegisterClientScriptInclude("shell", ResolveClientUrl("Scripts/shell.js")); } if (!cs.IsClientScriptIncludeRegistered("popupWindow")) { Random rnd = new Random(); cs.RegisterClientScriptInclude("popupWindow", ResolveClientUrl("Scripts/popupWindow.js?" + rnd.Next(1, 1000).ToString())); } }
private void RegisterShortCutKeyScripts() { string clientScriptFileKey = "ClientScriptsFile"; string cookieSessionIdFileKey = "CookieSessionScriptFile"; string clientScriptWireUpKey = "ShortCutKeyWireUp"; Type clientScriptManagerType = this.GetType(); ClientScriptManager clientScriptManager = this.Page.ClientScript; // Check to see if the client script is already registered. if (!clientScriptManager.IsClientScriptIncludeRegistered(clientScriptManagerType, clientScriptFileKey)) { string clientScriptUrl = this.ResolveUrl("~/script/scripts.js"); clientScriptManager.RegisterClientScriptInclude(clientScriptManagerType, clientScriptFileKey, clientScriptUrl); } if (!clientScriptManager.IsClientScriptIncludeRegistered(clientScriptManagerType, cookieSessionIdFileKey)) { string clientScriptUrl = this.ResolveUrl("~/script/cookie-session-id.js"); clientScriptManager.RegisterClientScriptInclude(clientScriptManagerType, cookieSessionIdFileKey, clientScriptUrl); } // make sure scripts have not already been registered if (!clientScriptManager.IsStartupScriptRegistered(clientScriptManagerType, clientScriptWireUpKey)) { string clientScriptWireUpText = @"document.onkeyup = ShortCutKeyCapture;"; clientScriptManager.RegisterStartupScript(clientScriptManagerType, clientScriptWireUpKey, clientScriptWireUpText, true); } }
protected void dynamicLoad_metaData() { try { HtmlLink link = new HtmlLink(); link.Href = "~/Styles/eggPlantModified.css"; link.Attributes.Add("type", "text/css"); link.Attributes.Add("rel", "stylesheet"); this.Header.Controls.Add(link); String csname = "dynumScript"; String csurl = "~/Scripts/showBiz.js"; Type cstype = this.GetType(); ClientScriptManager cs = Page.ClientScript; csname = "jDataTables"; csurl = "~/Scripts/jquery.dataTables.min.js"; if (!cs.IsClientScriptIncludeRegistered(cstype, csname)) { cs.RegisterClientScriptInclude(cstype, csname, ResolveClientUrl(csurl)); } csname = "dynumScript"; csurl = "~/Scripts/myNetwork.js"; if (!cs.IsClientScriptIncludeRegistered(cstype, csname)) { cs.RegisterClientScriptInclude(cstype, csname, ResolveClientUrl(csurl)); } } catch (Exception err) { // System.Windows.Forms.MessageBox.Show(err.Message); } }
protected void Page_Load(object sender, EventArgs e) { Page.Header.Controls.Add(new LiteralControl("<link rel=\"stylesheet\" type=\"text/css\" href=\"" + ResolveUrl("~/Styles/jquery-ui.css") + "\" />")); ClientScriptManager cs = Page.ClientScript; if (!cs.IsClientScriptIncludeRegistered("jquery")) { cs.RegisterClientScriptInclude("jquery", ResolveClientUrl("Scripts/jquery-1.11.2.min.js")); } if (!cs.IsClientScriptIncludeRegistered("jquery-ui")) { cs.RegisterClientScriptInclude("jquery-ui", ResolveClientUrl("Scripts/jquery-ui.min.js")); } if (!cs.IsClientScriptIncludeRegistered("common")) { cs.RegisterClientScriptInclude("common", ResolveClientUrl("Scripts/common.js")); } if (!cs.IsClientScriptIncludeRegistered("shell")) { cs.RegisterClientScriptInclude("shell", ResolveClientUrl("Scripts/shell.js")); } if (!cs.IsClientScriptIncludeRegistered("popupWindow")) { cs.RegisterClientScriptInclude("popupWindow", ResolveClientUrl("Scripts/popupWindow.js")); } }
protected override void OnPreRender(EventArgs e) { base.OnPreRender(e); if (ControlPanel.Visible) { PageBase.RegisterStyleSheet(Page, "~/admin/ControlPanel/module.css"); ClientScriptManager cs = Page.ClientScript; if (!cs.IsClientScriptIncludeRegistered("hoverintent")) { cs.RegisterClientScriptInclude("hoverintent", Globals.ResolveUrl("~/Resources/Shared/Scripts/jquery/jquery.hoverIntent.min.js")); } if (!cs.IsClientScriptIncludeRegistered("ControlPanel")) { if (HttpContext.Current.IsDebuggingEnabled) { cs.RegisterClientScriptInclude("ControlPanel", Globals.ResolveUrl("~/Resources/ControlPanel/ControlPanel.debug.js")); } else { cs.RegisterClientScriptInclude("ControlPanel", Globals.ResolveUrl("~/Resources/ControlPanel/ControlPanel.js")); } } } cmdVisibility.Visible = false; }
protected override void OnPreRender(EventArgs e) { base.OnPreRender(e); if ((EnsureScriptManager()) && (!_scriptManager.IsClientScriptIncludeRegistered(_type, "flowplayer"))) { _scriptManager.RegisterClientScriptInclude(_type, "flowplayer", _scriptManager.GetWebResourceUrl(_type, "Instinct.Resource_.FlowPlayer.flowplayer-3.1.4.min.js")); } }
protected override void OnPreRender(EventArgs e) { base.OnPreRender(e); ClientScriptManager scripts = Page.ClientScript; if (!scripts.IsClientScriptIncludeRegistered("jquery")) { scripts.RegisterClientScriptInclude("jquery", Page.ResolveClientUrl(ScriptPath + "js/jquery.js")); } if (!scripts.IsClientScriptIncludeRegistered("colorpicker")) { scripts.RegisterClientScriptInclude("colorpicker", Page.ResolveClientUrl(ScriptPath + "js/colorpicker.js")); } if (!scripts.IsClientScriptIncludeRegistered("eye")) { scripts.RegisterClientScriptInclude("eye", Page.ResolveClientUrl(ScriptPath + "js/eye.js")); } if (!scripts.IsClientScriptIncludeRegistered("utils")) { scripts.RegisterClientScriptInclude("utils", Page.ResolveClientUrl(ScriptPath + "js/utils.js")); } StringBuilder script = new StringBuilder(); script.AppendLine("<script type=\"text/javascript\">(function($){"); script.AppendLine("var initLayout = function() {"); script.AppendLine(string.Format("$('#colorSelector{0}').ColorPicker(", PickerID)); script.AppendLine("{onShow: function (colpkr) {"); script.AppendLine("$(colpkr).fadeIn(500);"); script.AppendLine("return false;"); script.AppendLine("},"); script.AppendLine("onBeforeShow: function(){"); script.AppendLine("$(this).ColorPickerSetColor(this.childNodes[0].style.backgroundColor);"); script.AppendLine("},"); script.AppendLine("onHide: function (colpkr) {"); script.AppendLine("$(colpkr).fadeOut(500);"); script.AppendLine("return false;"); script.AppendLine("},"); script.AppendLine("onChange: function (hsb, hex, rgb) {"); script.AppendLine( string.Format("$('#colorSelector{0} div').css('backgroundColor', '#' + hex);", PickerID)); script.AppendLine( string.Format("$('#colorSelectorInner{0} div').css('backgroundColor', '#' + hex);", PickerID)); script.AppendLine(string.Format("$('#{0}').val('#'+hex);", ID)); script.AppendLine("}});}; EYE.register(initLayout, 'init');})(jQuery)</script>"); if (!scripts.IsStartupScriptRegistered(typeof(ColorPicker), "register" + PickerID)) { scripts.RegisterStartupScript(typeof(ColorPicker), "register" + PickerID, script.ToString()); } }
protected void Page_Load(object sender, EventArgs e) { Page.Header.Controls.Add(new LiteralControl("<link rel=\"stylesheet\" type=\"text/css\" href=\"" + ResolveUrl("~/Styles/jquery-ui.css") + "\" />")); ClientScriptManager cs = Page.ClientScript; if (!cs.IsClientScriptIncludeRegistered("jquery")) { cs.RegisterClientScriptInclude("jquery", ResolveClientUrl("Scripts/jquery-1.11.2.min.js")); } if (!cs.IsClientScriptIncludeRegistered("jquery-ui")) { cs.RegisterClientScriptInclude("jquery-ui", ResolveClientUrl("Scripts/jquery-ui.min.js")); } if (!cs.IsClientScriptIncludeRegistered("common")) { cs.RegisterClientScriptInclude("common", ResolveClientUrl("Scripts/common.js")); } if (!cs.IsClientScriptIncludeRegistered("shell")) { cs.RegisterClientScriptInclude("shell", ResolveClientUrl("Scripts/shell.js")); } if (!cs.IsClientScriptIncludeRegistered("popupWindow")) { cs.RegisterClientScriptInclude("popupWindow", ResolveClientUrl("Scripts/popupWindow.js")); } if (!cs.IsClientScriptBlockRegistered("underscore")) { cs.RegisterClientScriptInclude("underscore", ResolveClientUrl("Scripts/underscore-min.js")); } if (!cs.IsClientScriptBlockRegistered("underscorestring")) { cs.RegisterClientScriptInclude("underscorestring", ResolveClientUrl("Scripts/underscore.string.min.js")); } if (!cs.IsClientScriptBlockRegistered("moment")) { cs.RegisterClientScriptInclude("moment", ResolveClientUrl("Scripts/moment.min.js")); } if (Request.ServerVariables["NeedsPDFViewer"] != null && Request.ServerVariables["NeedsPDFViewer"].ToString().ToLower() == "true") { cs.RegisterClientScriptInclude("pdfviewer", ResolveClientUrl("Scripts/pdf.js")); cs.RegisterClientScriptInclude("pdfviewer", ResolveClientUrl("Scripts/pdf.worker.js")); } }
protected void dynamicLoad_metaData() { try { String csname = "CommonScript"; String csurl = "~/Scripts/bizinfo.js"; Type cstype = this.GetType(); // System.Windows.Forms.MessageBox.Show("er1"); // Get a ClientScriptManager reference from the Page class. ClientScriptManager cs = Page.ClientScript; // Check to see if the include script exists already. if (!cs.IsClientScriptIncludeRegistered(cstype, csname)) { cs.RegisterClientScriptInclude(cstype, csname, ResolveClientUrl(csurl)); // System.Windows.Forms.MessageBox.Show("er2"); } /******************************************************************************* * * CODE TO DYNAMICALLY LOAD CSS FILES TO WEBPAGE * * CODE starts Here -- */ } catch (Exception err) { System.Windows.Forms.MessageBox.Show(err.Message); } }
void DoRegisterScript() { ClientScriptManager sc = this.Page.Page.ClientScript; string scriptString = sc.GetWebResourceUrl(this.GetType(), "WebDropDownCheckBoxList.Resources.DropDownCheckBoxList.js"); if (!sc.IsClientScriptIncludeRegistered("DropDownGridScriptKey")) { sc.RegisterClientScriptInclude(this.GetType(), "DropDownGridScriptKey", scriptString); } scriptString = Page.Form.Attributes["onclick"]; if (string.IsNullOrEmpty(scriptString)) { scriptString = string.Format("responseOnFormClick(event,'{0}');", this.ClientID); } else { scriptString = string.Format("{0} responseOnFormClick(event,'{1}');", scriptString, this.ClientID); } Page.Form.Attributes.Add("onclick", scriptString); this.Page.RegisterRequiresPostBack(this); }
protected void Page_Load(object sender, EventArgs e) { ///////////////////////////////////////////// // Register the scripts.js javascript file // ///////////////////////////////////////////// String csname = "scriptsJs"; String csurl = Orchestrator.Globals.Configuration.WebServer + "/script/scripts.js"; Type cstype = this.GetType(); // Get a ClientScriptManager reference from the Page class. ClientScriptManager csm = Page.ClientScript; // Check to see if the include script exists already. if (!csm.IsClientScriptIncludeRegistered(cstype, csname)) { csm.RegisterClientScriptInclude(cstype, csname, csurl); } //this.coverContentDiv.Visible = false; //this.coverContentDiv.Style.Add(HtmlTextWriterStyle.Display, "none"); //this.loadingDiv.Visible = false; //this.loadingDiv.Style.Add(HtmlTextWriterStyle.Display, "none"); //this.loadingImageDiv.Visible = false; //this.loadingImageDiv.Style.Add(HtmlTextWriterStyle.Display, "none"); }
/// <summary> /// 页面注册脚本(客户端方式):动态加载js文件 /// </summary> /// <param name="page"></param> /// <param name="key"></param> /// <param name="url"></param> public static void Create(Page page, string key, string url) { ClientScriptManager csm = page.ClientScript; if (!csm.IsClientScriptIncludeRegistered(key)) { csm.RegisterClientScriptInclude(key, url); } }
/// <summary> /// 註冊指令碼(框架設定) /// </summary> protected void scriptFramSet() { ClientScriptManager cs = Page.ClientScript; if (!cs.IsClientScriptIncludeRegistered(this.GetType(), "scriptFramSet")) { cs.RegisterClientScriptInclude("scriptFramSet", Request.ApplicationPath + "/js/Common/FrameSet.js"); } }
protected void Page_Load(object sender, EventArgs e) { ClientScriptManager cs = Page.ClientScript; if (!cs.IsClientScriptIncludeRegistered("reports")) { cs.RegisterClientScriptInclude("reports", ResolveClientUrl("Scripts/reports.js")); } }
public static void RegistrarScriptInclude(Page page, string key, string url) { ClientScriptManager sm = page.ClientScript; if (!sm.IsClientScriptIncludeRegistered(key)) { sm.RegisterClientScriptInclude(key, page.ResolveUrl(url)); } }
/// <summary> /// 在网页中添加JavaScript /// </summary> /// <param name="js">ScriptScript脚本</param> /// <param name="page">提示的当前页面</param> /// <remarks> /// </remarks> public static void ShowJavaScript(String js, Page page) { ClientScriptManager csm = page.ClientScript; if (!csm.IsClientScriptIncludeRegistered("clientScript")) { csm.RegisterStartupScript(page.GetType(), "client_js", js, true); } }
/// <summary> /// 在页面里加入一个js文件 /// </summary> /// <param name="page">System.Web.UI.Page</param> /// <param name="key">要注册客户端脚本包含的键</param> /// <param name="url">要注册客户端脚本包含的url</param> public static void JsInclude(Page page, string key, string url) { // Get a ClientScriptManager reference from the Page class. ClientScriptManager clientScript = page.ClientScript; if (!clientScript.IsClientScriptIncludeRegistered(key)) { clientScript.RegisterClientScriptInclude(key, url); } }
void master_Page_PreLoad(object sender, EventArgs e) { Page.Header.Controls.Add(new LiteralControl("<link rel=\"stylesheet\" type=\"text/css\" href=\"" + ResolveUrl("~/Styles/jquery-ui.css") + "\" />")); ClientScriptManager cs = Page.ClientScript; if (!cs.IsClientScriptIncludeRegistered("jquery")) { cs.RegisterClientScriptInclude("jquery", ResolveClientUrl("Scripts/jquery-1.11.2.min.js")); } if (!cs.IsClientScriptIncludeRegistered("jquery-ui")) { cs.RegisterClientScriptInclude("jquery-ui", ResolveClientUrl("Scripts/jquery-ui.min.js")); } if (!cs.IsClientScriptIncludeRegistered("common")) { cs.RegisterClientScriptInclude("common", ResolveClientUrl("Scripts/common.js")); } if (!cs.IsClientScriptIncludeRegistered("shell")) { cs.RegisterClientScriptInclude("shell", ResolveClientUrl("Scripts/shell.js")); } if (!cs.IsClientScriptIncludeRegistered("popupWindow")) { cs.RegisterClientScriptInclude("popupWindow", ResolveClientUrl("Scripts/popupWindow.js")); } if (!IsPostBack) { // Set Anti-XSRF token ViewState[AntiXsrfTokenKey] = Page.ViewStateUserKey; ViewState[AntiXsrfUserNameKey] = Context.User.Identity.Name ?? String.Empty; } else { // Validate the Anti-XSRF token if ((string)ViewState[AntiXsrfTokenKey] != _antiXsrfTokenValue || (string)ViewState[AntiXsrfUserNameKey] != (Context.User.Identity.Name ?? String.Empty)) { throw new InvalidOperationException("Validation of Anti-XSRF token failed."); } } }
public void ClientScriptManager_RegisterClientScriptIncludeException_2() { Page p = new Page(); String csname = "ButtonClickScript"; String csurl = "ClientScript.js"; ClientScriptManager cs = p.ClientScript; cs.RegisterClientScriptInclude(null, csname, csurl); bool registry = cs.IsClientScriptIncludeRegistered(csname); }
public static void Alert(String message, string url, Page page) { String js = "alert(\"" + message + "\"); \n document.location.href=\"" + url + "\";"; ClientScriptManager csm = page.ClientScript; if (!csm.IsClientScriptIncludeRegistered("clientScript")) { csm.RegisterStartupScript(page.GetType(), "js_alert_and_location", js, true); } }
/// <summary> /// 提示Alert对话框 /// </summary> /// <param name="message">要提示的信息</param> /// <param name="page">提示的当前页面</param> /// <remarks> /// </remarks> public static void Alert(String message, Page page) { String js = "alert(\"" + message + "\");"; ClientScriptManager csm = page.ClientScript; if (!csm.IsClientScriptIncludeRegistered("clientScript")) { csm.RegisterStartupScript(page.GetType(), "js_alert", js, true); } }
protected void RegisterClientScript(string key, string url) { Type type = GetType(); ClientScriptManager clientScriptManager = Page.ClientScript; if (!clientScriptManager.IsClientScriptIncludeRegistered(type, key)) { clientScriptManager.RegisterClientScriptInclude(type, key, ResolveClientUrl(url)); } }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); ClientScriptManager csm = Page.ClientScript; if (!csm.IsClientScriptIncludeRegistered("uploadercontrol")) { csm.RegisterClientScriptInclude("uploadercontrol", ResolveClientUrl(_scriptPath)); } }
protected void Page_Load(object sender, EventArgs e) { ClientScriptManager cs = Page.ClientScript; if (!cs.IsClientScriptIncludeRegistered("common")) { cs.RegisterClientScriptInclude("common", ResolveClientUrl("~/Scripts/common.js")); } if (!cs.IsClientScriptIncludeRegistered("jquery")) { cs.RegisterClientScriptInclude("jquery", ResolveClientUrl("~/Scripts/jquery-1.11.2.js")); } if (!cs.IsClientScriptIncludeRegistered("shell")) { cs.RegisterClientScriptInclude("shell", ResolveClientUrl("~/Scripts/shell.js")); } if (!cs.IsClientScriptIncludeRegistered("popupWindow")) { cs.RegisterClientScriptInclude("popupWindow", ResolveClientUrl("~/Scripts/popupWindow.js")); } }
public static void RegistrarScriptIncludes(Page page) { ClientScriptManager sm = page.ClientScript; foreach (var item in Constantes.ScriptIncludes) { if (!sm.IsClientScriptIncludeRegistered(item.Key)) { sm.RegisterClientScriptInclude(item.Key, page.ResolveUrl(item.Value)); } } }
public void ClientScriptManager_IsRegisterOnSubmitStatement() { Page p = new Page(); String csname = "ButtonClickScript"; Type cstype = p.GetType(); ClientScriptManager cs = p.ClientScript; cs.RegisterClientScriptInclude(cstype, csname, "document.write('Text from OnSubmit statement');"); bool registry = cs.IsClientScriptIncludeRegistered(cstype, csname); Assert.AreEqual(true, registry, "RegisterClientScriptIncludeFail"); }
public void ClientScriptManager_IsRegisterClientScriptInclude() { Page p = new Page(); String csname = "ButtonClickScript"; String csurl = "ClientScript.js"; Type cstype = p.GetType(); ClientScriptManager cs = p.ClientScript; cs.RegisterClientScriptInclude(cstype, csname, csurl); bool registry = cs.IsClientScriptIncludeRegistered(cstype, csname); Assert.AreEqual(true, registry, "RegisterClientScriptIncludeFail"); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { dirPre = getDirPre(); ClientScriptManager sm = Page.ClientScript; if (!sm.IsClientScriptIncludeRegistered("selEmp")) { sm.RegisterClientScriptInclude("selEmp", dirPre + "UCtrl/js/SelEmp.js"); } } }
protected override void Initialize() { ClientScriptManager cs = this.Page.ClientScript; string url = "../ajax/Ext2.0/adapter/ext/ext-base.js"; if (!cs.IsClientScriptIncludeRegistered("ext-base_js")) { cs.RegisterClientScriptInclude(this.GetType(), "ext-base_js", url); } url = "../ajax/Ext2.0/ext-all.js"; if (!cs.IsClientScriptIncludeRegistered("ext-all_js")) { cs.RegisterClientScriptInclude(this.GetType(), "ext-all_js", url); } url = "../ajax/ArticleTree.js"; if (!cs.IsClientScriptIncludeRegistered("ArticleTree_js")) { cs.RegisterClientScriptInclude(this.GetType(), "ArticleTree_js", url); } HtmlGenericControl cssLink = new HtmlGenericControl("link"); cssLink.Attributes["rel"] = "stylesheet"; cssLink.Attributes["type"] = "text/css"; cssLink.Attributes["href"] = "../ajax/Ext2.0/resources/css/ext-all.css"; this.Header.Controls.Add(cssLink); if (IsWap) { NameLabel.Text = "WAP文章管理"; } url = "articlelist.aspx" + Request.Url.Query; ListTypeHyperLink.NavigateUrl = We7Helper.AddParamToUrl(url, "notiframe", "1"); TreeTypeHyperLink.NavigateUrl = "articles.aspx" + Request.Url.Query; }