/// <summary> /// Register the client-side script block in the ASPX page. /// </summary> public void RegisterAPIScriptBlock() { // Register the script block is not allready done. if (!Page.IsClientScriptBlockRegistered(SCRIPTKEY)) { if ((this.ExternalScript == null || this.ExternalScript == string.Empty) && (this.ScriptDirectory == null || this.ScriptDirectory.TrimEnd() == string.Empty)) { string CLIENTSIDE_API = EditorHelper.GetResource("ActiveUp.WebControls._resources.ActiveAutoSuggest.js"); #if (!FX1_1) Page.ClientScript.RegisterClientScriptInclude(SCRIPTKEY, Page.ClientScript.GetWebResourceUrl(this.GetType(), "ActiveUp.WebControls._resources.ActiveAutoSuggest.js")); #else if (!CLIENTSIDE_API.StartsWith("<script")) { CLIENTSIDE_API = "<script language=\"javascript\">\n" + CLIENTSIDE_API; } CLIENTSIDE_API += "\n</script>\n"; Page.RegisterClientScriptBlock(SCRIPTKEY, CLIENTSIDE_API); #endif } else { if (this.ScriptDirectory.StartsWith("~")) { this.ScriptDirectory = this.ScriptDirectory.Replace("~", System.Web.HttpContext.Current.Request.ApplicationPath.TrimEnd('/')); } Page.RegisterClientScriptBlock(SCRIPTKEY, "<script language=\"javascript\" src=\"" + this.ScriptDirectory.TrimEnd('/') + "/" + (this.ExternalScript == string.Empty ? "ActiveAutoSuggest.js" : this.ExternalScript) + "\" type=\"text/javascript\"></SCRIPT>"); } } Page.TestAndRegisterScriptBlock(SCRIPTKEY, ScriptDirectory, "AAS_TestIfScriptPresent()"); }
/// <summary> /// Registers the API script block. /// </summary> /// <param name="page">The page.</param> public virtual void RegisterAPIScriptBlock(System.Web.UI.Page page) { // Register the script block is not allready done. if (!Page.IsClientScriptBlockRegistered(SCRIPTKEY)) { if ((this.ExternalScript == null || this.ExternalScript.TrimEnd() == string.Empty) && (this.ScriptDirectory == null || this.ScriptDirectory.TrimEnd() == string.Empty)) { #if (!FX1_1) Page.ClientScript.RegisterClientScriptInclude(SCRIPTKEY, Page.ClientScript.GetWebResourceUrl(this.GetType(), "ActiveUp.WebControls._resources.ActiveRotator.js")); #else if (CLIENTSIDE_API == null) { CLIENTSIDE_API = EditorHelper.GetResource("ActiveUp.WebControls._resources.ActiveRotator.js"); } if (!CLIENTSIDE_API.StartsWith("<script")) { CLIENTSIDE_API = "<script language=\"javascript\">\n" + CLIENTSIDE_API; } CLIENTSIDE_API += "\n</script>\n"; Page.RegisterClientScriptBlock(SCRIPTKEY, CLIENTSIDE_API); #endif } else { if (this.ScriptDirectory.StartsWith("~")) { this.ScriptDirectory = this.ScriptDirectory.Replace("~", System.Web.HttpContext.Current.Request.ApplicationPath.TrimEnd('/')); } Page.RegisterClientScriptBlock(SCRIPTKEY, "<script language=\"javascript\" src=\"" + this.ScriptDirectory.TrimEnd('/') + "/" + (this.ExternalScript == string.Empty ? "ActiveRotator.js" : this.ExternalScript) + "\" type=\"text/javascript\"></SCRIPT>"); } } /*string startupString = "<script language='javascript'>\n"; * startupString += "var atv_" + this.ClientID + "_de = '" + this.Icons.Default + "'\n"; * startupString += "var atv_" + this.ClientID + "_ex = '" + this.Icons.Expanded + "'\n"; * startupString += "var atv_" + this.ClientID + "_co = '" + this.Icons.Collapsed + "'\n"; * startupString += "</script>\n"; * * page.RegisterStartupScript("ActiveTree_Startup_" + this.ClientID, startupString);*/ if (!Page.IsClientScriptBlockRegistered(SCRIPTKEY + "_startup")) { string startupString = string.Empty; startupString += "<script>\n"; startupString += "// Test if the client script is present.\n"; startupString += "try\n{\n"; startupString += "ACR_testIfScriptPresent();\n"; //startupString += "}\ncatch (e) \n{\nalert('Could not find external script file. Please Check the documentation.');\n}\n"; startupString += "}\n catch (e)\n {\n alert('Could not find script file. Please ensure that the Javascript files are deployed in the " + ((ScriptDirectory == string.Empty) ? string.Empty : " [" + ScriptDirectory + "] directory or change the") + "ScriptDirectory and/or ExternalScript properties to point to the directory where the files are.'); \n}\n"; startupString += "</script>\n"; page.RegisterClientScriptBlock(SCRIPTKEY + "_startup", startupString); } }
/// <summary> /// Register the client side script block in the ASP page. /// </summary> protected void RegisterScriptBlock() { if (!Page.IsClientScriptBlockRegistered(SCRIPTKEY)) { if ((this.ExternalScript == null || this.ExternalScript == string.Empty) && (this.ScriptDirectory == null || this.ScriptDirectory.TrimEnd() == string.Empty)) { #if (!FX1_1) Page.ClientScript.RegisterClientScriptInclude(SCRIPTKEY, Page.ClientScript.GetWebResourceUrl(this.GetType(), "ActiveUp.WebControls._resources.ActiveSlider.js")); #else if (CLIENTSIDE_API == string.Empty) { CLIENTSIDE_API = EditorHelper.GetResource("ActiveUp.WebControls._resources.ActiveSlider.js"); } if (!CLIENTSIDE_API.StartsWith("<script")) { CLIENTSIDE_API = "<script language=\"javascript\">\n" + CLIENTSIDE_API; } CLIENTSIDE_API += "\n</script>\n"; Page.RegisterClientScriptBlock(SCRIPTKEY, CLIENTSIDE_API); #endif } else { if (this.ScriptDirectory.StartsWith("~")) { this.ScriptDirectory = this.ScriptDirectory.Replace("~", System.Web.HttpContext.Current.Request.ApplicationPath.TrimEnd('/')); } Page.RegisterClientScriptBlock(SCRIPTKEY, "<script language=\"javascript\" src=\"" + this.ScriptDirectory.TrimEnd('/') + "/" + (this.ExternalScript == string.Empty ? "ActiveSlider.js" : this.ExternalScript) + "\" type=\"text/javascript\"></SCRIPT>"); } } string startupString = "<script language='javascript'>\n"; startupString += "// Variable declaration related to the control '" + ClientID + "'\n"; startupString += ClientID + "_min=" + _min + ";\n"; startupString += ClientID + "_max=" + _max + ";\n"; startupString += ClientID + "_step=" + _step + ";\n"; startupString += ClientID + "_minusArrowOffImage=\"" + Utils.ConvertToImageDir(ImagesDirectory, MinusArrowOffImage, "ArrowUpOff.gif", Page, this.GetType()) + "\";\n"; startupString += ClientID + "_minusArrowOnImage=\"" + Utils.ConvertToImageDir(ImagesDirectory, _minusArrowOnImage, "ArrowUpOn.gif", Page, this.GetType()) + "\";\n"; startupString += ClientID + "_plusArrowOffImage=\"" + Utils.ConvertToImageDir(ImagesDirectory, PlusArrowOffImage, "ArrowDownOff.gif", Page, this.GetType()) + "\";\n"; startupString += ClientID + "_plusArrowOnImage=\"" + Utils.ConvertToImageDir(ImagesDirectory, _plusArrowOnImage, "ArrowDownOn.gif", Page, this.GetType()) + "\";\n"; startupString += ClientID + "_liftOn=\"" + Utils.ConvertToImageDir(ImagesDirectory, LiftOn, "BackgroundVertOn.gif", Page, this.GetType()) + "\";\n"; startupString += ClientID + "_liftOff=\"" + Utils.ConvertToImageDir(ImagesDirectory, _liftOff, "BackgroundVertOff.gif", Page, this.GetType()) + "\";\n"; startupString += ClientID + "_directStep=\"" + _directStep + "\";\n"; startupString += ClientID + "_speedArrow=" + _speedArrow + ";\n"; startupString += ClientID + "_speedOutLift=" + _speedOutLift + ";\n"; startupString += ClientID + "_onValueChanged=\"" + _onValueChangedClient + "\";\n"; startupString += ClientID + "_direction=\"" + _direction.ToString() + "\";\n"; startupString += "try\n{\n"; startupString += "ASD_SetValue('" + ClientID + "'," + _currentValue + ");\n"; startupString += "}\n catch (e)\n {\n alert('Could not find script file. Please ensure that the Javascript files are deployed in the " + ((ScriptDirectory == string.Empty) ? string.Empty : " [" + ScriptDirectory + "] directory or change the") + "ScriptDirectory and/or ExternalScript properties to point to the directory where the files are.'); \n}\n"; startupString += "</script>\n"; Page.RegisterStartupScript(ClientID + "_startup", startupString); }
/// <summary> /// Register the Client-Side script block in the ASPX page. /// </summary> protected void RegisterClientSideScriptBlock(System.Web.UI.Page page) { // Register the script block is not allready done. if (!page.IsClientScriptBlockRegistered(this.ScriptKey)) { if ((this.ExternalScript == null || this.ExternalScript == string.Empty) && (this.ScriptDirectory == null || this.ScriptDirectory.TrimEnd() == string.Empty)) { #if (!FX1_1) Page.ClientScript.RegisterClientScriptInclude(ScriptKey, Page.ClientScript.GetWebResourceUrl(this.GetType(), ResourceName)); #else if (CLIENTSIDE_API == null) { CLIENTSIDE_API = EditorHelper.GetResource(this.ResourceName).ToString(); } if (!CLIENTSIDE_API.StartsWith("<script")) { CLIENTSIDE_API = "<script language=\"javascript\">\n" + CLIENTSIDE_API; } CLIENTSIDE_API += "\n</script>\n"; page.RegisterClientScriptBlock(this.ScriptKey, CLIENTSIDE_API); #endif } else { if (this.ScriptDirectory.StartsWith("~")) { this.ScriptDirectory = this.ScriptDirectory.Replace("~", System.Web.HttpContext.Current.Request.ApplicationPath.TrimEnd('/')); } page.RegisterClientScriptBlock(this.ScriptKey, "<script language=\"javascript\" src=\"" + this.ScriptDirectory.TrimEnd('/') + "/" + (this.ExternalScript == string.Empty ? "ActiveInput.js" : this.ExternalScript) + "\" type=\"text/javascript\"></SCRIPT>"); } } if (!Page.IsClientScriptBlockRegistered(this.ScriptKey + "_startup")) { string startupString = string.Empty; startupString += "<script>\n"; startupString += "// Test if the client script is present.\n"; startupString += "try\n{\n"; startupString += "AIP_testIfScriptPresent();\n"; startupString += "}\n catch (e)\n {\n alert('Could not find script file. Please ensure that the Javascript files are deployed in the " + ((ScriptDirectory == string.Empty) ? string.Empty : " [" + ScriptDirectory + "] directory or change the") + "ScriptDirectory and/or ExternalScript properties to point to the directory where the files are.'); \n}\n"; startupString += "</script>\n"; page.RegisterClientScriptBlock(this.ScriptKey + "_startup", startupString); } }
/// <summary> /// Register the client-side script block in the ASPX page. /// </summary> public void RegisterAPIScriptBlock() { // Register the script block is not allready done. if (!Page.IsClientScriptBlockRegistered(SCRIPTKEY)) { if ((this.ExternalScript == null || this.ExternalScript == string.Empty) && (this.ScriptDirectory == null || this.ScriptDirectory.TrimEnd() == string.Empty)) { #if (!FX1_1) Page.ClientScript.RegisterClientScriptInclude(SCRIPTKEY, Page.ClientScript.GetWebResourceUrl(this.GetType(), "ActiveUp.WebControls._resources.ActivePanel.js")); #else string CLIENTSIDE_API = EditorHelper.GetResource("ActiveUp.WebControls._resources.ActivePanel.js"); //string CLIENTSIDE_API = EditorHelper.GetResource("ActivePanel.ActivePanel.js"); if (!CLIENTSIDE_API.StartsWith("<script")) { CLIENTSIDE_API = "<script language=\"javascript\">\n" + CLIENTSIDE_API; } CLIENTSIDE_API += "\n</script>\n"; Page.RegisterClientScriptBlock(SCRIPTKEY, CLIENTSIDE_API); #endif } else { if (this.ScriptDirectory.StartsWith("~")) { this.ScriptDirectory = this.ScriptDirectory.Replace("~", System.Web.HttpContext.Current.Request.ApplicationPath.TrimEnd('/')); } Page.RegisterClientScriptBlock(SCRIPTKEY, "<script language=\"javascript\" src=\"" + this.ScriptDirectory.TrimEnd('/') + "/" + (this.ExternalScript == string.Empty ? "ActivePanel.js" : this.ExternalScript) + "\" type=\"text/javascript\"></SCRIPT>"); } } Page.TestAndRegisterScriptBlock(SCRIPTKEY, ScriptDirectory, "APN_TestIfScriptPresent()"); if (!Page.IsClientScriptBlockRegistered(SCRIPTKEY + "_Var_" + ClientID)) { string varString = string.Empty; varString += "<script>\n"; varString += "\n// Variable declaration related to the panel '" + ClientID + "'\n"; varString += ClientID + "_CollapsedImage='" + Utils.ConvertToImageDir(ImagesDirectory, CollapsedImage, "collapsed.gif", Page, this.GetType()) + "';\n"; varString += ClientID + "_ExpandedImage='" + Utils.ConvertToImageDir(ImagesDirectory, ExpandedImage, "expanded.gif", Page, this.GetType()) + "';\n"; varString += ClientID + "_OnTitleClickClientSide=\"" + OnTitleClickClientSide + "\";\n"; varString += ClientID + "_TitleBackColorCollapsed=\"" + Utils.Color2Hex(TitleBackColorCollapsed) + "\";\n"; varString += ClientID + "_TitleBackColorExpanded=\"" + Utils.Color2Hex(TitleBackColorExpanded) + "\";\n"; varString += ClientID + "_ScrollEffect=\"" + ScrollEffect + "\";\n"; if (ScrollEffect) { varString += ClientID + "_Fade=\"" + Fade + "\";\n"; varString += ClientID + "_Speed=\"" + Speed + "\";\n"; varString += ClientID + "_Frame=\"" + Frame + "\";\n"; } varString += "\n</script>\n"; Page.RegisterClientScriptBlock(SCRIPTKEY + "_Var_" + ClientID, varString); } if (!Page.IsClientScriptBlockRegistered(SCRIPTKEY + "_Init" + ClientID) && ScrollEffect) { string varString = string.Empty; varString += "<script language=\"javascript\">\n"; varString += $"function Init_{ClientID}(e)\n"; varString += "{\n"; varString += "var realSize = document.createElement(\"input\");\n"; varString += "realSize.setAttribute(\"type\",\"hidden\");\n"; varString += $"realSize.setAttribute(\"name\",\"{ClientID}_RealSize\");\n"; varString += $"realSize.setAttribute(\"id\",\"{ClientID}_RealSize\");\n"; varString += $"realSize.setAttribute(\"value\", document.getElementById('{ClientID}_Temp').clientHeight);\n"; varString += "document.body.appendChild(realSize);\n"; varString += $"document.getElementById('{ClientID}_Temp').removeNode(false);\n"; if (Fade) { varString += string.Format("var valueStep = 100 / (parseInt(document.getElementById('{0}_RealSize').value) / parseInt(eval('{0}_Frame'))); \n", ClientID); varString += "var fadeStep = document.createElement(\"input\");\n"; varString += "fadeStep.setAttribute(\"type\",\"hidden\");\n"; varString += $"fadeStep.setAttribute(\"name\",\"{ClientID}_FadeStep\");\n"; varString += $"fadeStep.setAttribute(\"id\",\"{ClientID}_FadeStep\");\n"; varString += string.Format("fadeStep.setAttribute(\"value\", Math.round(valueStep));\n", ClientID); varString += "document.body.appendChild(fadeStep);\n"; } varString += "}\n"; varString += $"window.RegisterEvent(\"onload\", Init_{ClientID});\n"; varString += "\n</script>\n"; Page.RegisterClientScriptBlock(SCRIPTKEY + "_Init" + ClientID, varString); } }
/// <summary> /// Register the client-side script block in the ASPX page. /// </summary> public void RegisterAPIScriptBlock() { // Register the script block is not allready done. if (!Page.IsClientScriptBlockRegistered(SCRIPTKEY)) { if ((this.ExternalScript == null || this.ExternalScript == string.Empty) && (this.ScriptDirectory == null || this.ScriptDirectory.TrimEnd() == string.Empty)) { #if (!FX1_1) Page.ClientScript.RegisterClientScriptInclude(SCRIPTKEY, Page.ClientScript.GetWebResourceUrl(this.GetType(), "ActiveUp.WebControls._resources.ActiveAjax.js")); #else string CLIENTSIDE_API = EditorHelper.GetResource("ActiveUp.WebControls._resources.ActiveAjax.js"); if (!CLIENTSIDE_API.StartsWith("<script")) { CLIENTSIDE_API = "<script language=\"javascript\">\n" + CLIENTSIDE_API; } CLIENTSIDE_API += "\n</script>\n"; Page.RegisterClientScriptBlock(SCRIPTKEY, CLIENTSIDE_API); #endif } else { if (this.ScriptDirectory.StartsWith("~")) { this.ScriptDirectory = this.ScriptDirectory.Replace("~", System.Web.HttpContext.Current.Request.ApplicationPath.TrimEnd('/')); } Page.RegisterClientScriptBlock(SCRIPTKEY, "<script language=\"javascript\" src=\"" + this.ScriptDirectory.TrimEnd('/') + "/" + (this.ExternalScript == string.Empty ? "ActiveAjax.js" : this.ExternalScript) + "\" type=\"text/javascript\"></SCRIPT>"); } } Page.TestAndRegisterScriptBlock(SCRIPTKEY, ScriptDirectory, "AA_TestIfScriptPresent()"); if (!Page.IsClientScriptBlockRegistered(string.Format("{0}_Var_{1}", SCRIPTKEY, ClientID))) { string varString = string.Empty; varString += "<script>\n"; varString += "\n// Variable declaration related to the ajax panel '" + ClientID + "'\n"; varString += string.Format("var ActiveAjax_{0} = new AA_CallBackObject('{0}');\n", this.ClientID); #if (DEBUG) varString += string.Format("ActiveAjax_{0}.Debug = true;\n", ClientID); #endif if (EncodeURIComponent) { varString += string.Format("ActiveAjax_{0}.EncodeURI = {1};\n", ClientID, EncodeURIComponent ? "true" : "false"); } if (SaveState) { varString += string.Format("ActiveAjax_{0}.SaveState = {1};\n", ClientID, SaveState ? "true" : "false"); } if (UseCache) { varString += string.Format("ActiveAjax_{0}.UseCache = {1};\n", ClientID, UseCache ? "true" : "false"); } if (OnAbort != string.Empty) { varString += string.Format("ActiveAjax_{0}.OnAbort = {1};\n", ClientID, OnAbort); } if (OnComplete != string.Empty) { varString += string.Format("ActiveAjax_{0}.OnComplete = {1};\n", ClientID, OnComplete); } if (OnError != string.Empty) { varString += string.Format("ActiveAjax_{0}.OnError = {1};\n", ClientID, OnError); } if (OnInteractive != string.Empty) { varString += string.Format("ActiveAjax_{0}.OnInteractive = {1};\n", ClientID, OnInteractive); } if (OnLoaded != string.Empty) { varString += string.Format("ActiveAjax_{0}.OnLoaded = {1};\n", ClientID, OnLoaded); } if (OnLoading != string.Empty) { varString += string.Format("ActiveAjax_{0}.OnLoading = {1};\n", ClientID, OnLoading); } if (OnUnitialized != string.Empty) { varString += string.Format("ActiveAjax_{0}.OnUnitialized = {1};\n", ClientID, OnUnitialized); } if (LoadingDisplay != string.Empty) { varString += string.Format("ActiveAjax_{0}.LoadingDisplay = '{1}';\n", ClientID, LoadingDisplay); } if (RequestAutoWidth) { varString += string.Format("ActiveAjax_{0}.RequestAutoWidth = {1};\n", ClientID, RequestAutoWidth ? "true" : "false"); } if (RequestAutoHeight) { varString += string.Format("ActiveAjax_{0}.RequestAutoHeight = {1};\n", ClientID, RequestAutoHeight ? "true" : "false"); } if (RefreshInterval > 0) { varString += string.Format("window.setInterval(\"ActiveAjax_{0}.DoActiveCallBack(\'{0}\',\'\');\",{1});\n", ClientID, RefreshInterval); } if (PostPanelOnly) { string controlsID = string.Empty; foreach (Control c in this.Controls) { //if (!(c is System.Web.UI.LiteralControl && ((System.Web.UI.LiteralControl)c).Text.StartsWith(_LITERAL_CONTENTS_TO_IGNORE_))) //{ controlsID += c.ClientID; controlsID += ','; //} } controlsID = controlsID.TrimEnd(','); varString += string.Format("ActiveAjax_{0}.PostPanelOnly = '{1}';\n", ClientID, controlsID); if (PostId.Length > 0) { varString += string.Format("ActiveAjax_{0}.PostId = '{1}';\n", ClientID, Utils.FormatStringArray(PostId, ',')); } } varString += "\n</script>\n"; Page.RegisterClientScriptBlock(SCRIPTKEY + "_Var_" + ClientID, varString); } }
private void RegisterScriptBlock() { /*if (!Page.IsClientScriptBlockRegistered("AU_WebTimer")) * { * * System.Text.StringBuilder api = new System.Text.StringBuilder(); * * api.Append("<script language=\"javascript\">\n"); * api.Append("function WTM_DoTimer(code, interval, repeat, init)\n"); * api.Append("{\n"); * api.Append(" if (!init)\n"); * api.Append(" setTimeout(code, 10);\n"); * api.Append("\n"); * api.Append(" if (repeat)\n"); * api.Append(" {\n"); * api.Append(" repeatStr = \"WTM_DoTimer(\\\"\" + code + \"\\\", \" + interval + \", \" + repeat + \", false);\";\n"); * api.Append(" setTimeout(repeatStr, interval);\n"); * api.Append(" }\n"); * api.Append(" else\n"); * api.Append(" setTimeout(code, interval);\n"); * api.Append("}\n"); * api.Append("function WTM_SetInterval(id, interval)\n"); * api.Append("{\n"); * api.Append(" document.getElementById(id + '_Interval').value = interval;\n"); * api.Append("}\n"); * api.Append("</script>\n"); * * Page.RegisterClientScriptBlock("AU_WebTimer", api.ToString()); * }*/ // Register the script block is not allready done. if (!Page.IsClientScriptBlockRegistered(SCRIPTKEY)) { if ((this.ExternalScript == null || this.ExternalScript.TrimEnd() == string.Empty) && (this.ScriptDirectory == null || this.ScriptDirectory.TrimEnd() == string.Empty)) { #if (!FX1_1) Page.ClientScript.RegisterClientScriptInclude(SCRIPTKEY, Page.ClientScript.GetWebResourceUrl(this.GetType(), "ActiveUp.WebControls._resources.ActiveTimer.js")); #else if (CLIENTSIDE_API == null) { CLIENTSIDE_API = EditorHelper.GetResource("ActiveUp.WebControls._resources.ActiveTimer.js"); } if (!CLIENTSIDE_API.StartsWith("<script")) { CLIENTSIDE_API = "<script language=\"javascript\">\n" + CLIENTSIDE_API; } CLIENTSIDE_API += "\n</script>\n"; Page.RegisterClientScriptBlock(SCRIPTKEY, CLIENTSIDE_API); #endif } else { if (this.ScriptDirectory.StartsWith("~")) { this.ScriptDirectory = this.ScriptDirectory.Replace("~", System.Web.HttpContext.Current.Request.ApplicationPath.TrimEnd('/')); } Page.RegisterClientScriptBlock(SCRIPTKEY, "<script language=\"javascript\" src=\"" + this.ScriptDirectory.TrimEnd('/') + "/" + (this.ExternalScript == string.Empty ? "ActiveTimer.js" : this.ExternalScript) + "\" type=\"text/javascript\"></SCRIPT>"); } } if (!Page.IsClientScriptBlockRegistered(SCRIPTKEY + "_startup")) { string startupString = string.Empty; startupString += "<script>\n"; startupString += "// Test if the client script is present.\n"; startupString += "try\n{\n"; startupString += "AWT_testIfScriptPresent();\n"; //startupString += "}\ncatch (e) \n{\nalert('Could not find external script file. Please Check the documentation.');\n}\n"; startupString += "}\n catch (e)\n {\n alert('Could not find script file. Please ensure that the Javascript files are deployed in the " + ((ScriptDirectory == string.Empty) ? string.Empty : " [" + ScriptDirectory + "] directory or change the") + "ScriptDirectory and/or ExternalScript properties to point to the directory where the files are.'); \n}\n"; startupString += "</script>\n"; Page.RegisterClientScriptBlock(SCRIPTKEY + "_startup", startupString); } if (!Page.IsClientScriptBlockRegistered("AWT_SERVERTIME")) { DateTime d = DateTime.Now; string nowDate = string.Format("{0},{1},{2},{3},{4},{5}", d.Year.ToString(), d.Month.ToString(), d.Day.ToString(), d.Hour.ToString(), d.Minute.ToString(), d.Second.ToString()); string serverTime = string.Format("<script language='javascript'>\nvar AWT_ServerTime = '{0}';\nvar AWT_ClientTime = new Date();\nvar AWT_DateDiff = AWT_ClientTime.getTime() - AWT_ParseDate(AWT_ServerTime).getTime();\n</script>", nowDate); Page.RegisterClientScriptBlock("AWT_SERVERTIME", serverTime); } }