public string GetJavaScriptReferenceCode(StringCollection method, string attributeName, string[] parameters) { if (string.CompareOrdinal(attributeName, "FileTypes") == 0) { return(string.Format(CultureInfo.InvariantCulture, "{0}.jsData.FileTypes", CodeName)); } if (string.CompareOrdinal(attributeName, "SelectedFilename") == 0) { return(string.Format(CultureInfo.InvariantCulture, "{0}.jsData.getSelectedFile()", CodeName)); } if (string.CompareOrdinal(attributeName, "SelectedFilePath") == 0) { return(string.Format(CultureInfo.InvariantCulture, "{0}.jsData.getSelectedFileFullPath()", CodeName)); } if (string.CompareOrdinal(attributeName, "SelectedFolderName") == 0) { return(string.Format(CultureInfo.InvariantCulture, "{0}.jsData.getSelectedFolder()", CodeName)); } if (string.CompareOrdinal(attributeName, "SelectedFolderPath") == 0) { return(string.Format(CultureInfo.InvariantCulture, "{0}.jsData.getSelectedFolderFullPath()", CodeName)); } string s = WebPageCompilerUtility.GetJavaScriptWebMethodReferenceCode(WebPageCompilerUtility.JsCodeRef(CodeName), attributeName, method, parameters); if (!string.IsNullOrEmpty(s)) { return(s); } return(null); }
public string GetJavaScriptReferenceCode(StringCollection method, string attributeName, string[] parameters) { if (string.CompareOrdinal(attributeName, "Visible") == 0) { return(string.Format(CultureInfo.InvariantCulture, "{0}.style.display", CodeName)); } if (string.CompareOrdinal(attributeName, "BackColor") == 0) { return(string.Format(CultureInfo.InvariantCulture, "{0}.style.backgroundColor", CodeName)); } if (string.CompareOrdinal(attributeName, "Text") == 0) { return(string.Format(CultureInfo.InvariantCulture, "JsonDataBinding.GetInnerText({0})", CodeName)); } if (string.CompareOrdinal(attributeName, "ForeColor") == 0) { return(string.Format(CultureInfo.InvariantCulture, "{0}.style.color", CodeName)); } string s = WebPageCompilerUtility.GetJavaScriptWebMethodReferenceCode(WebPageCompilerUtility.JsCodeRef(CodeName), attributeName, method, parameters); if (!string.IsNullOrEmpty(s)) { return(s); } return(null); }
public void CreateActionJavaScript(string methodName, StringCollection code, StringCollection parameters, string returnReceiver) { if (string.CompareOrdinal(methodName, "ClearFiles") == 0) { code.Add(string.Format(CultureInfo.InvariantCulture, "document.getElementById('{0}').loader.ClearFiles();\r\n", this.Site.Name)); } else if (string.CompareOrdinal(methodName, "RemoveFile") == 0) { code.Add(string.Format(CultureInfo.InvariantCulture, "document.getElementById('{0}').loader.RemoveFile({1});\r\n", this.Site.Name, parameters[0])); } else if (string.CompareOrdinal(methodName, "GetFiles") == 0) { code.Add(string.Format(CultureInfo.InvariantCulture, "document.getElementById('{0}').loader.GetFiles();\r\n", this.Site.Name)); } else { WebPageCompilerUtility.CreateActionJavaScript(WebPageCompilerUtility.JsCodeRef(CodeName), methodName, code, parameters, returnReceiver); } }
public void CreateActionJavaScript(string methodName, StringCollection code, StringCollection parameters, string returnReceiver) { if (string.CompareOrdinal(methodName, "IsFileTypeValid") == 0) { if (!string.IsNullOrEmpty(returnReceiver)) { code.Add(string.Format(CultureInfo.InvariantCulture, "{0}=({1}.value.split('.').pop().toLowerCase()>=0);\r\n", returnReceiver, WebPageCompilerUtility.JsCodeRef(CodeName))); } } else if (string.CompareOrdinal(methodName, "IsFileSizeValid") == 0) { if (!string.IsNullOrEmpty(returnReceiver)) { code.Add(string.Format(CultureInfo.InvariantCulture, "{0}={1}.jsData.IsFileSizeValid();\r\n", returnReceiver, WebPageCompilerUtility.JsCodeRef(CodeName))); } } else if (string.CompareOrdinal(methodName, "SetMaxFileSize") == 0) { code.Add(string.Format(CultureInfo.InvariantCulture, "{0}.jsData.SetMaxFileSize({1});\r\n", WebPageCompilerUtility.JsCodeRef(CodeName), parameters[0])); } else { WebPageCompilerUtility.CreateActionJavaScript(WebPageCompilerUtility.JsCodeRef(CodeName), methodName, code, parameters, returnReceiver); } }
public void CreateActionJavaScript(string methodName, StringCollection code, StringCollection parameters, string returnReceiver) { if (string.CompareOrdinal("AdjustHeight", methodName) == 0) { code.Add(string.Format(CultureInfo.InvariantCulture, "JsonDataBinding.adjustElementHeight({0});\r\n", WebPageCompilerUtility.JsCodeRef(CodeName))); return; } WebPageCompilerUtility.CreateActionJavaScript(WebPageCompilerUtility.JsCodeRef(CodeName), methodName, code, parameters, returnReceiver); }
public string GetJavaScriptReferenceCode(StringCollection method, string attributeName, string[] parameters) { string s = WebPageCompilerUtility.GetJavaScriptWebMethodReferenceCode(WebPageCompilerUtility.JsCodeRef(CodeName), attributeName, method, parameters); if (!string.IsNullOrEmpty(s)) { return(s); } return(null); }
public string GetJavaScriptReferenceCode(StringCollection method, string attributeName, string[] parameters) { if (string.CompareOrdinal(attributeName, "Started") == 0) { return("handle"); } string s = WebPageCompilerUtility.GetJavaScriptWebMethodReferenceCode(WebPageCompilerUtility.JsCodeRef(CodeName), attributeName, method, parameters); if (!string.IsNullOrEmpty(s)) { return(s); } return(null); }
public string GetJavaScriptReferenceCode(StringCollection method, string attributeName, string[] parameters) { if (string.CompareOrdinal(attributeName, "Text") == 0) { return(string.Format(CultureInfo.InvariantCulture, "{0}.value", WebPageCompilerUtility.JsCodeRef(CodeName))); } string s = WebPageCompilerUtility.GetJavaScriptWebMethodReferenceCode(WebPageCompilerUtility.JsCodeRef(CodeName), attributeName, method, parameters); if (!string.IsNullOrEmpty(s)) { return(s); } return(null); }
public void CreateActionJavaScript(string methodName, StringCollection code, StringCollection parameters, string returnReceiver) { string nm; if (this.Site == null && (string.IsNullOrEmpty(id) || string.CompareOrdinal(id, "''") == 0) && !string.IsNullOrEmpty(_vaname)) { nm = _vaname; } else { nm = WebPageCompilerUtility.JsCodeRef(CodeName); } WebPageCompilerUtility.CreateActionJavaScript(nm, methodName, code, parameters, returnReceiver); }
public void CreateActionJavaScript(string methodName, StringCollection code, StringCollection parameters, string returnReceiver) { if (string.CompareOrdinal(methodName, "getPrimaryKey") == 0) { if (!string.IsNullOrEmpty(returnReceiver)) { code.Add(string.Format(CultureInfo.InvariantCulture, "{0}={1}.jsData.getPrimaryKey();\r\n", returnReceiver, this.CodeName)); } } else { WebPageCompilerUtility.CreateActionJavaScript(WebPageCompilerUtility.JsCodeRef(CodeName), methodName, code, parameters, returnReceiver); } }
public void CreateActionJavaScript(string methodName, StringCollection code, StringCollection parameters, string returnReceiver) { if (string.CompareOrdinal(methodName, "AddFileUploader") == 0) { string fl = Site.Name; code.Add(string.Format(CultureInfo.InvariantCulture, "var {0} = document.createElement('input'); {0}.name = '{0}[]'; {0}.type = 'file'; {0}.style.width = '100%';\r\n", fl)); code.Add(string.Format(CultureInfo.InvariantCulture, "document.getElementById('{0}').appendChild({1});", this.Site.Name, fl)); } else { WebPageCompilerUtility.CreateActionJavaScript(WebPageCompilerUtility.JsCodeRef(CodeName), methodName, code, parameters, returnReceiver); } }
public string GetJavaScriptReferenceCode(StringCollection method, string attributeName, string[] parameters) { if (string.CompareOrdinal(attributeName, "SelectedItem") == 0 || string.CompareOrdinal(attributeName, "selectedItem") == 0) { return(string.Format(CultureInfo.InvariantCulture, "JsonDataBinding.GetSelectedListText({0})", CodeName)); } else if (string.CompareOrdinal(attributeName, "SelectedValue") == 0 || string.CompareOrdinal(attributeName, "selectedValue") == 0) { return(string.Format(CultureInfo.InvariantCulture, "JsonDataBinding.GetSelectedListValue({0})", CodeName)); } string s = WebPageCompilerUtility.GetJavaScriptWebMethodReferenceCode(WebPageCompilerUtility.JsCodeRef(CodeName), attributeName, method, parameters); if (!string.IsNullOrEmpty(s)) { return(s); } return(null); }
public string GetJavaScriptReferenceCode(StringCollection method, string attributeName, string[] parameters) { if (string.CompareOrdinal("SelectedDateTime", attributeName) == 0) { return(string.Format(CultureInfo.InvariantCulture, "JsonDataBinding.GetDatetimePickerSelectedValue('{0}')", CodeName)); } if (string.CompareOrdinal("IncludeTime", attributeName) == 0) { return(string.Format(CultureInfo.InvariantCulture, "JsonDataBinding.IsDatetimePickerIncludeTime('{0}')", CodeName)); } string s = WebPageCompilerUtility.GetJavaScriptWebMethodReferenceCode(WebPageCompilerUtility.JsCodeRef(RuntimeID), attributeName, method, parameters); if (!string.IsNullOrEmpty(s)) { return(s); } return(null); }
public string GetJavaScriptReferenceCode(StringCollection method, string attributeName, string[] parameters) { if (string.CompareOrdinal(attributeName, "IsFileTypeValid") == 0) { return(string.Format(CultureInfo.InvariantCulture, "{0}.toLowerCase().indexOf({1}.{2}.value.split('.').pop().toLowerCase()) >= 0", parameters[0], this.FormName, Site.Name)); } if (string.CompareOrdinal(attributeName, "IsFileSizeValid") == 0) { return(string.Format(CultureInfo.InvariantCulture, "{0}.jsData.IsFileSizeValid({1})", Site.Name, parameters[0])); } string s = WebPageCompilerUtility.GetJavaScriptWebMethodReferenceCode(WebPageCompilerUtility.JsCodeRef(CodeName), attributeName, method, parameters); if (!string.IsNullOrEmpty(s)) { return(s); } return(null); }
public void OnWebPageLoadedAfterEventHandlerCreations(StringCollection sc) { bool inDataRepeater = false; Control p = this.Parent; while (p != null) { if (p is HtmlDataRepeater) { inDataRepeater = true; break; } p = p.Parent; } if (!inDataRepeater) { if (this.SelectedDateTime != null && this.SelectedDateTime.Value != DateTime.MinValue) { sc.Add(string.Format(CultureInfo.InvariantCulture, "JsonDataBinding.SetDatetimePickerSelectedValue('{0}','{1}');\r\n", this.Site.Name, this.SelectedDateTime.Value.ToString("yyyy-MM-dd hh:mm:ss", CultureInfo.InvariantCulture))); } sc.Add(string.Format(CultureInfo.InvariantCulture, "{0}.style.left = {1}+'px';\r\n", WebPageCompilerUtility.JsCodeRef(RuntimeID), this.Left)); sc.Add(string.Format(CultureInfo.InvariantCulture, "{0}.style.top = {1}+'px';\r\n", WebPageCompilerUtility.JsCodeRef(RuntimeID), this.Top)); if (!_visible) { sc.Add(string.Format(CultureInfo.InvariantCulture, "{0}.style.display = 'none';\r\n", WebPageCompilerUtility.JsCodeRef(RuntimeID))); } } }
public void CreateActionJavaScript(string methodName, StringCollection code, StringCollection parameters, string returnReceiver) { WebPageCompilerUtility.CreateActionJavaScript(WebPageCompilerUtility.JsCodeRef(CodeName), methodName, code, parameters, returnReceiver); }
public void CreateActionJavaScript(string methodName, StringCollection code, StringCollection parameters, string returnReceiver) { if (string.CompareOrdinal(methodName, "AddItem") == 0) { if (parameters == null || parameters.Count == 0) { throw new WebBuilderException("HtmlListBox is Missing parameters for AddItem"); } string vn = string.Format(CultureInfo.InvariantCulture, "v{0}", ((uint)(Guid.NewGuid().GetHashCode())).ToString("x", CultureInfo.InvariantCulture)); code.Add(string.Format(CultureInfo.InvariantCulture, "var {0}=document.createElement('option');\r\n", vn)); code.Add(string.Format(CultureInfo.InvariantCulture, "{0}.text={1};\r\n", vn, parameters[0])); if (parameters.Count > 1) { if (!string.IsNullOrEmpty(parameters[1])) { code.Add(string.Format(CultureInfo.InvariantCulture, "{0}.value={1};\r\n", vn, parameters[1])); } } code.Add(string.Format(CultureInfo.InvariantCulture, "{0}.options.add({1});\r\n", CodeName, vn)); } else if (string.CompareOrdinal(methodName, "RemoveItemByValue") == 0) { if (parameters == null || parameters.Count == 0) { throw new WebBuilderException("HtmlListBox is Missing parameters for RemoveItemByValue"); } string idx = string.Format(CultureInfo.InvariantCulture, "i{0}", Guid.NewGuid().GetHashCode().ToString("x", CultureInfo.InvariantCulture)); code.Add(string.Format(CultureInfo.InvariantCulture, "for(var {0}=0;{0}<{1}.options.length;{0}++) {{\r\nif({1}.options[{0}].value == {2}) {{\r\n{1}.remove({0});\r\nbreak;\r\n}}\r\n}}\r\n", idx, CodeName, parameters[0])); } else if (string.CompareOrdinal(methodName, "RemoveItemByText") == 0) { if (parameters == null || parameters.Count == 0) { throw new WebBuilderException("HtmlListBox is Missing parameters for RemoveItemByText"); } string idx = string.Format(CultureInfo.InvariantCulture, "i{0}", Guid.NewGuid().GetHashCode().ToString("x", CultureInfo.InvariantCulture)); code.Add(string.Format(CultureInfo.InvariantCulture, "for(var {0}=0;{0}<{1}.options.length;{0}++) {{\r\nif({1}.options[{0}].text == {2}) {{\r\n{1}.remove({0});\r\nbreak;\r\n}}\r\n}}\r\n", idx, CodeName, parameters[0])); } else if (string.CompareOrdinal(methodName, "RemoveItemByIndex") == 0) { if (parameters == null || parameters.Count == 0) { throw new WebBuilderException("HtmlListBox is Missing parameters for RemoveItemByIndex"); } code.Add(string.Format(CultureInfo.InvariantCulture, "if({0} >= 0 && {0} < {1}.options.length) {{ {1}.remove({0}); }}\r\n", parameters[0], CodeName)); } else if (string.CompareOrdinal(methodName, "RemoveSelectedItem") == 0) { code.Add(string.Format(CultureInfo.InvariantCulture, "if({0}.selectedIndex >= 0 && {0}.selectedIndex < {0}.options.length) {{ {0}.remove({0}.selectedIndex); }}\r\n", CodeName)); } else if (!WebPageCompilerUtility.CreateActionJavaScript(WebPageCompilerUtility.JsCodeRef(CodeName), methodName, code, parameters, returnReceiver)) { } }
public void CreateActionJavaScript(string methodName, StringCollection code, StringCollection parameters, string returnReceiver) { if (string.CompareOrdinal(methodName, "ResetCurrentFolder") == 0) { code.Add(string.Format(CultureInfo.InvariantCulture, "{0}.jsData.resetCurrentFolder();\r\n", WebPageCompilerUtility.JsCodeRef(CodeName))); } else if (string.CompareOrdinal(methodName, "RestartFileBrowser") == 0) { code.Add(string.Format(CultureInfo.InvariantCulture, "var {0} = document.getElementById('{0}');\r\n", CodeName)); code.Add(string.Format(CultureInfo.InvariantCulture, "{0}.jsData.restart({1},{2},{3});\r\n", CodeName, parameters[0], parameters[1], parameters[2])); } }
public void OnWebPageLoaded(StringCollection sc) { if (this.HeightType == SizeType.AutoSize) { sc.Add(string.Format(CultureInfo.InvariantCulture, "JsonDataBinding.adjustElementHeight({0});\r\n", WebPageCompilerUtility.JsCodeRef(CodeName))); } }