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 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 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 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")); //} } }
private void IncludeCssAndJs() { ClientScriptManager cs = this.Page.ClientScript; // Include the jquery library (if not already included) string jqueryScriptUrl = this.TemplateSourceDirectory + "/js/jquery-2.1.1.min.js"; if (!cs.IsStartupScriptRegistered(jqueryScriptUrl)) { cs.RegisterClientScriptInclude(jqueryScriptUrl, jqueryScriptUrl); } // Include the notifier.js library (if not already included) string notifierScriptUrl = this.TemplateSourceDirectory + "/js/notifier.js"; if (!cs.IsStartupScriptRegistered(notifierScriptUrl)) { cs.RegisterClientScriptInclude(notifierScriptUrl, notifierScriptUrl); } // Include the bootstrap.css stylesheet (if not already included) /* string cssRelativeUrl = this.TemplateSourceDirectory + * "/css/bootstrap.css"; * if (!cs.IsClientScriptBlockRegistered(cssRelativeUrl)) * { * string cssLinkCode = string.Format( * @"<link href='{0}' rel='stylesheet' type='text/css' />", * cssRelativeUrl); * cs.RegisterClientScriptBlock(this.GetType(), cssRelativeUrl, cssLinkCode); * }*/ }
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")); } }
/// <summary> /// Embeds a link to a script resource into the page including the /// script tags. Uses Page.ClientScript so the link is embedded into /// the page content rather than the header. /// /// Preferrably use ClientScriptProxy.RegisterClientScriptInclude instead /// as it provides more options (including placement in header) /// </summary> /// <param name="control"></param> /// <param name="type"></param> /// <param name="resourceName"></param> public static void RegisterClientScriptResource(Type type, string resourceName) { if (ScriptCompressionModule.ScriptCompressionModuleActive) { Page page = HttpContext.Current.CurrentHandler as Page; if (page == null) { throw new InvalidOperationException("RegisterClientScriptResource must be called in the context of an ASP.NET Page."); } string resName = HttpUtility.UrlEncode(resourceName); ClientScriptManager script = page.ClientScript; string baseUrl = page.ResolveUrl("~/wwSC.axd?"); // Resources from this assembly don't need assembly name/id if (type.Assembly == typeof(ScriptCompressionModule).GetType().Assembly) { script.RegisterClientScriptInclude(type, baseUrl + "r=" + resName, baseUrl + "r=" + resName); } else { string url = string.Format(baseUrl + "r={0}&t={1}", resName, type.FullName); string typName = HttpUtility.UrlEncode(type.FullName); script.RegisterClientScriptInclude(type, url, url); } } }
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 IncludeTheCssAndJavaScript() { ClientScriptManager cs = Page.ClientScript; // Include the jQuery library (if not already included) string jqueryURL = this.TemplateSourceDirectory + "/Scripts/jquery-1.3.2.js"; if (!cs.IsStartupScriptRegistered(jqueryURL)) { cs.RegisterClientScriptInclude(jqueryURL, jqueryURL); } // Include the ErrorSuccessNotifier.js library (if not already included) string notifierScriptURL = this.TemplateSourceDirectory + "/Scripts/ErrorSuccessNotifier.js"; if (!cs.IsStartupScriptRegistered(notifierScriptURL)) { cs.RegisterClientScriptInclude(notifierScriptURL, notifierScriptURL); } // Include the ErrorSuccessNotifier.css stylesheet (if not already included) string cssRelativeURL = this.TemplateSourceDirectory + "/Styles/ErrorSuccessNotifier.css"; if (!cs.IsClientScriptBlockRegistered(cssRelativeURL)) { string cssLinkCode = string.Format( @"<link href='{0}' rel='stylesheet' type='text/css' />", cssRelativeURL); cs.RegisterClientScriptBlock(this.GetType(), cssRelativeURL, cssLinkCode); } }
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 void Page_Load(object sender, EventArgs e) { ClientScriptManager cs = Page.ClientScript; cs.RegisterClientScriptInclude("jquery", ResolveUrl("~/JavaScript/jquery-1.4.4.min.js")); cs.RegisterClientScriptInclude("jqueryui", ResolveUrl("~/JavaScript/jquery-ui-1.8.9.min.js")); // cs.RegisterClientScriptBlock(this.GetType(), "jquerycss", // "<link rel='stylesheet' type='text/css' href='" + ResolveUrl("~/App_Themes/Default/Styles/jquery-ui-1.8.9.css") + "' />"); if (!IsPostBack) { BindItemTypes(); } }
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) { this.Initialization(); ClientScriptManager clientScript = this.Page.ClientScript; clientScript.RegisterClientScriptInclude("jquery", base.ResolveUrl("~/JavaScript/jquery-1.12.3.min.js")); clientScript.RegisterClientScriptInclude("bootstrap", base.ResolveUrl("~/JavaScript/bootstrap/bootstrap.min.js")); clientScript.RegisterClientScriptBlock(base.GetType(), "BootstrapDropDownList", "<script type=\"text/javascript\">\nfunction BootstrapDropDownListSelect(link)\n{\n a = $(link); li = a.parent(); ul = li.parent(); ddl = ul.parent();\n hd = ddl.children().eq(0); btn = ddl.children().eq(1); \n lit = btn.children().eq(0); hdval = ddl.children().eq(2);\n index = li.index();\n itemvalue = li.attr('value');\n lit.html(a.html());\n ul.children().removeClass('active');\n li.addClass('active');\n hd.val(index);\n hdval.val(itemvalue);\n}\n</script>"); if (base.IsPostBack && this.SelectedIndexChanged != null && this.ViewState["index"] != null && (int)this.ViewState["index"] != this.SelectedIndex) { this.SelectedIndexChanged(this, new EventArgs()); } }
protected void Page_Load(object sender, EventArgs e) { ClientScriptManager cs = Page.ClientScript; cs.RegisterClientScriptInclude("jquery", ResolveUrl("~/JavaScript/jquery-1.4.4.min.js")); cs.RegisterClientScriptInclude("jqueryui", ResolveUrl("~/JavaScript/jquery-ui-1.8.9.min.js")); if (Page.IsPostBack == false) { SetDefaultMonitoringTimeFrame(); BindPerformanceValues(); } }
protected void Page_Load(object sender, EventArgs e) { JavaScriptSerializer javaScriptSerializer = new JavaScriptSerializer(); string item = ""; if (this.UserGlobalMailTemplateCSS) { item = ES.Services.Users.GetUserSettings(PanelSecurity.SelectedUserId, "GlobalMailTemplateCSS")["CSS"]; } ClientScriptManager clientScript = this.Page.ClientScript; clientScript.RegisterClientScriptInclude("tinymce", base.ResolveUrl("~/tinymce/tinymce.min.js")); clientScript.RegisterClientScriptInclude("jquery.tinymce", base.ResolveUrl("~/tinymce/jquery.tinymce.min.js")); clientScript.RegisterClientScriptBlock(base.GetType(), "tinymce.textarea", string.Concat("<script language='javascript' type='text/javascript'>\n $().ready(function () {\n tinymce.init({\n selector: '.htmlarea',\n plugins: [\n 'advlist autolink lists link image charmap print preview anchor',\n 'searchreplace visualblocks code fullscreen',\n 'insertdatetime media table contextmenu paste code'\n ],\n toolbar: 'insertfile undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image | code',\n removed_menuitems: 'newdocument',\n custom_elements : 'ad:if,ad:elseif,ad:else,ad:foreach,ad:for,ad:set,ad:template',\n extended_valid_elements : 'ad:if[test],ad:elseif[test],ad:else[test],ad:foreach[collection|var|index],ad:for[from|to|index],ad:set[name|value],ad:template[name]',\n protect : [\n /\\<\\/?ad\\:[^>]+\\>/g\n ],\n ", (string.IsNullOrEmpty(item) ? "" : string.Concat("content_style: ", javaScriptSerializer.Serialize(item), ",")), "\n statusbar: false,\n force_br_newlines : false,\n force_p_newlines : false,\n forced_root_block : '',\n });\n });\n </script>")); }
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 Page_Load(object sender, EventArgs e) { ClientScriptManager cs = Page.ClientScript; cs.RegisterClientScriptInclude("jquery", ResolveUrl("~/JavaScript/jquery-1.4.4.min.js")); cntx = PackagesHelper.GetCachedPackageContext(PanelSecurity.PackageId); if (!IsPostBack) { BindStats(); } BindServiceLevels(); if (cntx.Quotas.ContainsKey(Quotas.EXCHANGE2007_ISCONSUMER)) { if (cntx.Quotas[Quotas.EXCHANGE2007_ISCONSUMER].QuotaAllocatedValue != 1) { gvMailboxes.Columns[6].Visible = false; } } gvMailboxes.Columns[4].Visible = cntx.Groups.ContainsKey(ResourceGroups.ServiceLevels); }
protected void Page_Load(object sender, EventArgs e) { ClientScriptManager cs = Page.ClientScript; cs.RegisterClientScriptInclude("jquery", ResolveUrl("~/JavaScript/jquery-1.4.4.min.js")); dnsRecords = new Dictionary <int, string>(); gvDomains.PageSize = UsersHelper.GetDisplayItemsPerPage(); // visibility chkRecursive.Visible = (PanelSecurity.SelectedUser.Role != UserRole.User); gvDomains.Columns[5].Visible = gvDomains.Columns[6].Visible = (PanelSecurity.SelectedUser.Role != UserRole.User) && chkRecursive.Checked; gvDomains.Columns[7].Visible = (PanelSecurity.SelectedUser.Role == UserRole.Administrator); gvDomains.Columns[8].Visible = (PanelSecurity.EffectiveUser.Role == UserRole.Administrator); if (!IsPostBack) { // toggle controls btnAddDomain.Enabled = PackagesHelper.CheckGroupQuotaEnabled(PanelSecurity.PackageId, ResourceGroups.Os, Quotas.OS_DOMAINS) || PackagesHelper.CheckGroupQuotaEnabled(PanelSecurity.PackageId, ResourceGroups.Os, Quotas.OS_SUBDOMAINS) || PackagesHelper.CheckGroupQuotaEnabled(PanelSecurity.PackageId, ResourceGroups.Os, Quotas.OS_DOMAINPOINTERS); searchBox.AddCriteria("DomainName", GetLocalizedString("SearchField.DomainName")); if ((PanelSecurity.SelectedUser.Role != UserRole.User) && chkRecursive.Checked) { searchBox.AddCriteria("Username", GetLocalizedString("SearchField.Username")); searchBox.AddCriteria("FullName", GetLocalizedString("SearchField.FullName")); searchBox.AddCriteria("Email", GetLocalizedString("SearchField.Email")); } } searchBox.AjaxData = this.GetSearchBoxAjaxData(); }
/// <summary> /// Registers the scripts. /// </summary> /// <param name="rules">The rules.</param> public void RegisterScripts(RuleCollection rules) { ClientScriptManager scriptManager = _page.ClientScript; string initScriptResourceUrl = scriptManager.GetWebResourceUrl(_registerType, ModelPropertyValidator.WebformValidateResourceName); scriptManager.RegisterClientScriptInclude(_registerType, "WebformValidate", initScriptResourceUrl); string validateInitScript = String.Format("$(document).ready(function(){{ $webformValidate.init('#{0}'); }});{1}", _page.Form.ClientID, Environment.NewLine); scriptManager.RegisterStartupScript(_registerType, "WebformValidateInit", validateInitScript, true); StringBuilder validationOptionsScript = new StringBuilder(); validationOptionsScript.AppendFormat("$(document).ready(function(){{ $('#{0}').rules('add', ", _controlToValidateId); JavaScriptSerializer serializer = new JavaScriptSerializer(); serializer.RegisterConverters(new[] { new RulesJavaScriptConverter() }); serializer.Serialize(rules, validationOptionsScript); validationOptionsScript.AppendLine("); });"); scriptManager.RegisterStartupScript( _registerType, _controlToValidateId, validationOptionsScript.ToString(), true); }
protected void Page_Load(object sender, EventArgs e) { ClientScriptManager cs = Page.ClientScript; cs.RegisterClientScriptInclude("jquery", ResolveUrl("~/JavaScript/jquery-1.4.4.min.js")); if (HeliconApeStatus.IsInstalled) { if (!IsPostBack) { WebSite site = null; try { site = ES.Services.WebServers.GetWebSite(PanelRequest.ItemID); } catch (Exception ex) { HostModule.ShowErrorMessage("WEB_GET_SITE", ex); return; } if (site == null) { RedirectToBrowsePage(); } BindHeliconApe(site); } } }
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); } }
/// <summary> /// 向前台输出JQuery代码(此方法将代码加载在文档的最后) /// </summary> /// <param name="page"></param> /// <param name="Key"></param> /// <param name="Script"></param> public static void InsertJQueryCodeByRegisterStartupScript(Page page, string Key, string Script) { ClientScriptManager cm = page.ClientScript; cm.RegisterClientScriptInclude("QutoJQuery", "./JavaScript/jquery-1.9.1.js"); cm.RegisterStartupScript(page.GetType(), Key, Script, true); }
//HES: temporarily replaced pollutant info page with cms text protected void Page_Init(object sender, EventArgs e) { // Define an HtmlLink control. HtmlLink myCSSHtmlLink = new HtmlLink(); myCSSHtmlLink.Href = "css/sheetStyles.css"; myCSSHtmlLink.Attributes.Add("rel", "stylesheet"); myCSSHtmlLink.Attributes.Add("type", "text/css"); // Define an HtmlLink control. HtmlLink myPollutantCSSHtmlLink = new HtmlLink(); myPollutantCSSHtmlLink.Href = "css/PollutantInfo.css"; myPollutantCSSHtmlLink.Attributes.Add("rel", "stylesheet"); myPollutantCSSHtmlLink.Attributes.Add("type", "text/css"); // Add the HtmlLink to the Head section of the page. Page.Header.Controls.Add(myCSSHtmlLink); Page.Header.Controls.Add(myPollutantCSSHtmlLink); //Javascript files // Get a ClientScriptManager reference from the Page class. ClientScriptManager jmol = Page.ClientScript; jmol.RegisterClientScriptInclude(this.GetType(), "jmol", VirtualPathUtility.ToAbsolute("~/Jmol/Jmol.js")); ClientScriptManager jquery = Page.ClientScript; jquery.RegisterClientScriptInclude(this.GetType(), "jquery", VirtualPathUtility.ToAbsolute("~/JavaScript/jquery.js")); ClientScriptManager pl = Page.ClientScript; pl.RegisterClientScriptInclude(this.GetType(), "pollutantList", VirtualPathUtility.ToAbsolute("~/JavaScript/PollutantList.js")); }
/// <summary> /// Setup include files, js and css files /// </summary> private void SetupIncludes() { ClientScriptManager cs = Page.ClientScript; string csName = "dummyScript1"; Type csType = this.GetType(); if (!cs.IsStartupScriptRegistered(csType, csName)) { // Register dummy startup script so that this is only added for the first control cs.RegisterStartupScript(csType, csName, "", true); // Register Javascript Resource cs.RegisterClientScriptInclude( csType, "cs", Page.ClientScript.GetWebResourceUrl(csType, "Bright.WebControls.Resources.ThumbViewer.js")); // Add the style sheet to the document header string csslink = "\n<link href='" + Page.ClientScript.GetWebResourceUrl(csType, "Bright.WebControls.Resources.ThumbViewer.css") + "' rel='stylesheet' type='text/css' />"; LiteralControl include = new LiteralControl(csslink); this.Page.Header.Controls.Add(include); } }
protected void Page_Load(object sender, EventArgs e) { ClientScriptManager cs = Page.ClientScript; cs.RegisterClientScriptInclude("jquery", ResolveUrl("~/JavaScript/jquery-1.4.4.min.js")); locTitle.Text = ArchivingBoxes ? GetLocalizedString("locTitleArchiving.Text") : GetLocalizedString("locTitle.Text"); btnCreateMailbox.Visible = !ArchivingBoxes; cntx = PackagesHelper.GetCachedPackageContext(PanelSecurity.PackageId); if (!IsPostBack) { chkMailboxes.Checked = true; chkResourceMailboxes.Checked = true; chkSharedMailboxes.Checked = true; BindStats(); } BindServiceLevels(); if (cntx.Quotas.ContainsKey(Quotas.EXCHANGE2007_ISCONSUMER)) { if (cntx.Quotas[Quotas.EXCHANGE2007_ISCONSUMER].QuotaAllocatedValue != 1) { gvMailboxes.Columns[6].Visible = false; } } gvMailboxes.Columns[4].Visible = cntx.Groups.ContainsKey(ResourceGroups.ServiceLevels); }
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"); }
public void RenderScripts() { ClientScriptManager cs = Page.ClientScript; if (currentDocument != null && currentDocument.Id > 0 && !currentDocument.GenericProperties.Any(p => p.Id == -87 || p.PropertyType.Name.Contains("Richtext editor"))) { cs.RegisterClientScriptInclude("tinyMceCompress", "/umbraco/plugins/tinymce3/tinymce3tinymceCompress.aspx?themes=umbraco&plugins=contextmenu,umbracomacro,noneditable,inlinepopups,table,advlink,media,paste,spellchecker,umbracoimg,umbracocss&languages=en"); } StringBuilder sb = new StringBuilder(); sb.AppendFormat("var currentNodeId = '{0}';", currentDocument.Id); sb.AppendFormat("var wbBlockSourceNodeId = '{0}';", PreValueAccessor.BlockSourceNodeId); sb.Append("var wbServiceUrl = '/base/webblocks';"); sb.AppendFormat("var txtHiddenLayoutClientId = '{0}';", txtLayoutJSON.ClientID); sb.AppendFormat("var plcCotnfextMenuClientId = '{0}';", plcContextMenu.ClientID); sb.AppendFormat("var wbCanvas = '#{0}';", canvasRender.ClientID); sb.AppendFormat("var isProtectedPage = {0};", umbraco.library.IsProtected(currentDocument.Id, currentDocument.Path) ? "true" : "false"); sb.AppendFormat("var username = '******';", PreValueAccessor.ProtectedPageUsername); sb.AppendFormat("var password = '******';", PreValueAccessor.ProtectedPagePassword); sb.AppendFormat("var webBlocksGuid = '{0}';", Guid.NewGuid()); cs.RegisterStartupScript(GetType(), "WebBlocks", sb.ToString(), true); plcBackEndScriptIncludes.Controls.Add(new Literal() { Text = PreValueAccessor.BackEndScriptIncludes }); }
protected void Page_Load(object sender, EventArgs e) { ClientScriptManager cs = Page.ClientScript; cs.RegisterClientScriptInclude("jquery", ResolveUrl("~/JavaScript/jquery-1.4.4.min.js")); // Maintains appearance settings corresponding to user's display preferences gvApplications.PageSize = UsersHelper.GetDisplayItemsPerPage(); try { GalleryCategoriesResult result = ES.Services.WebApplicationGallery.GetGalleryCategories(PanelSecurity.PackageId); // if (!result.IsSuccess) { rbsCategory.Visible = false; messageBox.ShowMessage(result, "WAG_NOT_AVAILABLE", "ModuleWAG"); return; } if (!IsPostBack) { // SetLanguage(); BindLanguages(); BindCategories(); BindApplications(); ViewState["IsSearchResults"] = false; } } catch (Exception ex) { ShowErrorMessage("GET_WEB_GALLERY_CATEGORIES", ex); } }
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 override void OnPreRender(EventArgs e) { ClientScriptManager clientScript = this.Page.ClientScript; string webResourceUrl = clientScript.GetWebResourceUrl(base.GetType(), "EasyOne.Controls.ComboBox.ComboBox.js"); clientScript.RegisterClientScriptInclude(base.GetType(), "EasyOne.Controls.ComboBox.ComboBox.js", webResourceUrl); base.OnPreRender(e); }