private void ToButtonOption(ref StringBuilder sb, ColumnEditOptions columnEditOptions)
 {
     string value = columnEditOptions.Value.ToString();
     var buttonOptions = new StringBuilder();
     buttonOptions.AppendNonNullOrEmpty("value: {0}, ", Asq(value));
     AddCommonAttr(columnEditOptions, ref buttonOptions);
     buttonOptions.RemoveLast(COMMA);
     sb.AppendNonNullOrEmpty("edittype:'button', editoptions: {{{0}}}, ", buttonOptions);
 }
 private void ToCheckOption(ref StringBuilder sb, ColumnEditOptions columnEditOptions)
 {
     string value = (columnEditOptions.Value != null && (bool)columnEditOptions.Value != false)
                        ? "Yes:No"
                        : string.Empty;
     var checkOptions = new StringBuilder();
     checkOptions.AppendNonNullOrEmpty("value: {0}, ", value);
     AddCommonAttr(columnEditOptions, ref checkOptions);
     checkOptions.RemoveLast(COMMA);
     sb.AppendNonNullOrEmpty("edittype:'checkbox', editoptions: {{{0}}}, ", checkOptions);
 }
        public string ToScript()
        {
            if (_searchGrid == null) return string.Empty;
            var sb = new StringBuilder();
            if (_atNavigator)
                sb.Append("{");
            else
                sb.AppendFormat("$(\"#{0}\").jqGrid('searchGrid', {{", _gridName);

            sb.AppendNonNullOrEmpty("afterShowSearch: {0}, ", _searchGrid.AfterShowSearch)
                .AppendNonNullOrEmpty("beforeShowSearch: {0}, ", _searchGrid.BeforeShowSearch)
                .AppendNonNullOrEmpty("closeAfterSearch: {0}, ", ToLowerString(_searchGrid.CloseAfterSearch))
                .AppendNonNullOrEmpty("closeAfterReset: {0}, ", ToLowerString(_searchGrid.CloseAfterReset))
                .AppendNonNullOrEmpty("drag: {0}, ", ToLowerString(_searchGrid.Drag))
                .AppendNonNullOrEmpty("resize: {0}, ", ToLowerString(_searchGrid.Resize))
                .AppendNonNullOrEmpty("modal: {0}, ", ToLowerString(_searchGrid.Modal))
                .AppendNonNullOrEmpty("width: {0}, ", _searchGrid.Width)
                .AppendNonNullOrEmpty("height: {0}, ", Asq(_searchGrid.Height))
                .AppendNonNullOrEmpty("caption: {0}, ", Asq(_searchGrid.Caption))
                .AppendNonNullOrEmpty("showQuery: {0}, ", ToLowerString(_searchGrid.ShowQuery))
                .AppendNonNullOrEmpty("Find: {0}, ", Asq(_searchGrid.Find))
                .AppendNonNullOrEmpty("multipleSearch: {0}, ", ToLowerString(_searchGrid.MultipleSearch))
                .AppendNonNullOrEmpty("multipleGroup: {0}, ", ToLowerString(_searchGrid.MultipleGroup))
                .AppendNonNullOrEmpty("odata: {0}, ", _searchGrid.OData)
                .AppendNonNullOrEmpty("afterRedraw: {0}, ", _searchGrid.AfterRedraw)
                .AppendNonNullOrEmpty("onSearch: {0}, ", _searchGrid.OnSearch)
                .AppendNonNullOrEmpty("onReset: {0}, ", _searchGrid.OnReset)
                .AppendNonNullOrEmpty("closeOnEscape: {0}, ", ToLowerString(_searchGrid.CloseOnEscape))
                .AppendNonNullOrEmpty("onInitializeSearch: {0}, ", _searchGrid.OnInitializeSearch)
                .AppendNonNullOrEmpty("showOnLoad: {0}, ", ToLowerString(_searchGrid.ShowOnLoad))
                .AppendNonNullOrEmpty("errorcheck: {0}, ", ToLowerString(_searchGrid.Errorcheck))
                .AppendNonNullOrEmpty("Reset: {0}, ", Asq(_searchGrid.Reset))
                .AppendNonNullOrEmpty("sField: {0}, ", Asq(_searchGrid.SField))
                .AppendNonNullOrEmpty("sFilter: {0}, ", Asq(_searchGrid.SFilter))
                .AppendNonNullOrEmpty("sOper: {0}, ", Asq(_searchGrid.SOper))
                .AppendNonNullOrEmpty("sopt: {0}, ", _searchGrid.Sopt)
                .AppendNonNullOrEmpty("sValue: {0}, ", Asq(_searchGrid.SValue))
                .AppendNonNullOrEmpty("overlay: {0}, ", _searchGrid.Overlay)
                .AppendNonNullOrEmpty("layer: {0}, ", Asq(_searchGrid.Layer))
                .AppendNonNullOrEmpty("tmplNames: {0}, ", _searchGrid.TmplNames)
                .AppendNonNullOrEmpty("tmplFilters: {0}, ", _searchGrid.TmplFilters)
                .AppendNonNullOrEmpty("tmplLabel: {0}, ", Asq(_searchGrid.TmplLabel))
                .RemoveLast(COMMA)
                .Append(_atNavigator ? "}" : "});");
            return sb.ToString();
        }
 private void ToImageOption(ref StringBuilder sb, ColumnEditOptions columnEditOptions)
 {
     var imageOptions = new StringBuilder();
     imageOptions.AppendNonNullOrEmpty("src: {0}, ", columnEditOptions.ImageSrc);
     AddCommonAttr(columnEditOptions, ref imageOptions);
     imageOptions.RemoveLast(COMMA);
     sb.AppendNonNullOrEmpty("edittype:'image', editoptions: {{{0}}}, ", imageOptions);
 }
 private void AddCommonAttr(ColumnEditOptions columnEditOptions, ref StringBuilder options)
 {
     options.AppendNonNullOrEmpty("{0}, ", columnEditOptions.DataInit);
     options.AppendNonNullOrEmpty("{0}, ", columnEditOptions.DataEvents);
     options.AppendNonNullOrEmpty("{0}, ", columnEditOptions.DefaultValue);
     options.AppendNonNullOrEmpty("{0}, ", ToLowerString(columnEditOptions.NullIfEmpty));
     options.AppendNonNullOrEmpty("{0}, ", columnEditOptions.Attributes);
 }
 private void ToTextareaOption(ref StringBuilder sb, ColumnEditOptions columnEditOptions)
 {
     int rows = columnEditOptions.Rows ?? 2;
     int cols = columnEditOptions.Cols ?? 20;
     var textOptions = new StringBuilder();
     textOptions.AppendNonNullOrEmpty("rows: {0}, cols: {1}, ", rows, cols, 0);
     AddCommonAttr(columnEditOptions, ref textOptions);
     textOptions.RemoveLast(COMMA);
     sb.AppendNonNullOrEmpty("edittype:'textarea', editoptions: {{{0}}}, ", textOptions);
 }
 private void ToPasswordOption(ref StringBuilder sb, ColumnEditOptions columnEditOptions)
 {
     var passwordOptions = new StringBuilder();
     passwordOptions.AppendNonNullOrEmpty("size: {0}, ", columnEditOptions.Size);
     passwordOptions.AppendNonNullOrEmpty("maxlength: {0}, ", columnEditOptions.MaxLength);
     passwordOptions.AppendNonNullOrEmpty("readonly: {0}, ", ToLowerString(columnEditOptions.ReadOnly));
     AddCommonAttr(columnEditOptions, ref passwordOptions);
     passwordOptions.RemoveLast(COMMA);
     sb.AppendNonNullOrEmpty("edittype:'password', editoptions: {{{0}}}, ", passwordOptions);
 }
 private void ToTextOption(ref StringBuilder sb, ColumnEditOptions columnEditOptions)
 {
     var textOptions = new StringBuilder();
     textOptions.AppendNonNullOrEmpty("size: {0}, ", columnEditOptions.Size);
     textOptions.AppendNonNullOrEmpty("maxlength: {0}, ", columnEditOptions.MaxLength);
     textOptions.AppendNonNullOrEmpty("readonly: {0}, ", ToLowerString(columnEditOptions.ReadOnly));
     AddCommonAttr(columnEditOptions, ref textOptions);
     textOptions.RemoveLast(COMMA);
     string result = textOptions.ToString();
     sb.AppendNonNullOrEmpty("edittype:'text', editoptions: {{{0}}}, ", textOptions);
 }
 private void ToSelectOption(ref StringBuilder sb, ColumnEditOptions columnEditOptions)
 {
     var selectOptions = new StringBuilder();
     string selectValues = GetSelectValues(columnEditOptions);
     selectOptions.AppendNonNullOrEmpty("dataUrl: {0}, ", Asq(columnEditOptions.DataUrl));
     selectOptions.AppendNonNullOrEmpty("buildSelect: {0}, ", columnEditOptions.BuildSelect);
     selectOptions.AppendNonNullOrEmpty("value: {0}, ", selectValues);
     AddCommonAttr(columnEditOptions, ref selectOptions);
     selectOptions.RemoveLast(COMMA);
     sb.AppendNonNullOrEmpty("edittype:'select', editoptions: {{{0}}}, ", selectOptions);
 }
        public string ToScript()
        {
            if (_gridOptions.Columns == null) return string.Empty;
            var sb = new StringBuilder();
            string colNames = _gridOptions.Columns.Aggregate(string.Empty, (current, jqGridColumn) => current + Asq(jqGridColumn.Header) + ", ");
            colNames = colNames.Remove(colNames.LastIndexOf(','));
            sb.AppendFormat("colNames: [{0}], {1}", colNames, NewLine(PadLeftTo));

            sb.AppendFormat("colModel: [ {0}", NewLine(9));
            for (int i = 0; i < _gridOptions.Columns.Count; i++)
            {
                var item = _gridOptions.Columns[i];
                sb.AppendFormat("{{ name: {0}, ", Asq(item.Name));
                sb.AppendNonNullOrEmpty("index: {0}, ", Asq(item.Index));
                sb.AppendNonNullOrEmpty("width: {0}, ", item.Width);
                sb.AppendNonNullOrEmpty("align: {0}, ", Asq(GetAlignValue(item.Align)));
                sb.AppendNonNullOrEmpty("editable: {0}, ", ToLowerString(item.Editable));
                sb.Append(new ColumnFormOptionsToScript(item.FormOptions).ToScript());
                sb.AppendNonNullOrEmpty("sortable: {0}, ", ToLowerString(item.Sortable));
                sb.AppendNonNullOrEmpty("sorttype: {0}, ", Asq(GetColumnSortTypeValue(item.SortType)));
                sb.AppendNonNullOrEmpty("firstsortorder: {0}, ", Asq(item.FirstSortOrder));
                sb.AppendNonNullOrEmpty("search: {0}, ", ToLowerString(item.Search));
                sb.Append(new ColumnSearchOptionsToScript(item.SearchOptions).ToScript());
                sb.Append(new ColumnSearchRulesToScript(item.SearchRules).ToScript());
                sb.AppendNonNullOrEmpty("stype: {0}, ", Asq(item.SearchType));
                sb.AppendNonNullOrEmpty("surl: {0}, ", Asq(item.SUrl));
                sb.AppendNonNullOrEmpty("cellattr: {0}, ", item.CellAttribute);
                sb.AppendNonNullOrEmpty("classes: {0}, ", Asq(item.Classes));
                sb.AppendNonNullOrEmpty("datefmt: {0}, ", Asq(item.DateFormat));
                sb.AppendNonNullOrEmpty("defval: {0}, ", Asq(item.DefaultValue));
                sb.AppendNonNullOrEmpty("fixed: {0}, ", ToLowerString(item.Fixed));
                sb.AppendNonNullOrEmpty("formatoptions: {0}, ", item.FormatOptions);
                sb.AppendNonNullOrEmpty("formatter: {0}, ", item.Formatter);
                sb.AppendNonNullOrEmpty("hidedlg: {0}, ", ToLowerString(item.HideInDialog));
                sb.AppendNonNullOrEmpty("hidden: {0}, ", ToLowerString(item.Hidden));
                sb.AppendNonNullOrEmpty("fixed: {0}, ", ToLowerString(item.Fixed));
                sb.AppendNonNullOrEmpty("jsonmap: {0}, ", Asq(item.JsonMap));
                sb.AppendNonNullOrEmpty("key: {0}, ", ToLowerString(item.Key));
                sb.AppendNonNullOrEmpty("label: {0}, ", Asq(item.Label));
                sb.AppendNonNullOrEmpty("resizable: {0}, ", ToLowerString(item.Resizable));
                sb.AppendNonNullOrEmpty("template: {0}, ", item.Template);
                sb.AppendNonNullOrEmpty("title: {0}, ", ToLowerString(item.TitleOnHover));
                sb.AppendNonNullOrEmpty("xmlmap: {0}, ", item.XmlMap);
                sb.AppendNonNullOrEmpty("unformat: {0}, ", item.UnFormat);
                sb.AppendNonNullOrEmpty("viewable: {0}, ", ToLowerString(item.Viewable));
                sb.Append(new ColumnEditToScript(item.EditOptions).ToScript());
                sb.Append(new ColumnEditRulesToScript(item.EditRules).ToScript());

                //Cut off the last comma
                sb.RemoveLast(COMMA);
                sb.Append("}");
                if (i == _gridOptions.Columns.Count - 1) continue;
                sb.AppendFormat(",{0}", NewLine(9));
            }

            sb.AppendFormat("], {0}", NewLine(PadLeftTo));

            return sb.ToString();
        }
        private string AccumulateFormViewOptions(FormViewOptions formView)
        {
            if (formView == null) return NewLine(6) + "{}";
            var sb = new StringBuilder();
            sb.AppendLine().PadLeft(6);
            sb.Append("{");
            //properties
            sb.AppendNonNullOrEmpty("top: {0}, ", formView.Top);
            sb.AppendNonNullOrEmpty("left: {0}, ", formView.Left);
            sb.AppendNonNullOrEmpty("width: {0}, ", formView.Width);
            sb.AppendNonNullOrEmpty("height: {0}, ", formView.Height);
            sb.AppendNonNullOrEmpty("dataheight: {0}, ", formView.DataHeight);
            sb.AppendNonNullOrEmpty("modal: {0}, ", ToLowerString(formView.Modal));
            sb.AppendNonNullOrEmpty("drag: {0}, ", ToLowerString(formView.Drag));
            sb.AppendNonNullOrEmpty("resize: {0}, ", ToLowerString(formView.Resize));
            sb.AppendNonNullOrEmpty("jqModal: {0}, ", ToLowerString(formView.JqModal));
            sb.AppendNonNullOrEmpty("topinfo: {0}, ", Asq(formView.TopInfo));
            sb.AppendNonNullOrEmpty("bottominfo: {0}, ", Asq(formView.BottomInfo));
            sb.AppendNonNullOrEmpty("closeicon: {0}, ", Asq(formView.CloseIcon));
            sb.AppendNonNullOrEmpty("navkeys: {0}, ", formView.NavKeys);
            sb.AppendNonNullOrEmpty("closeOnEscape: {0}, ", ToLowerString(formView.CloseOnEscape));
            sb.AppendNonNullOrEmpty("viewPagerButtons: {0}, ", ToLowerString(formView.ViewPagerButtons));
            sb.AppendNonNullOrEmpty("labelswidth: {0}, ", Asq(formView.LabelsWidth));
            sb.AppendNonNullOrEmpty("zIndex: {0}, ", formView.ZIndex);
            //events
            sb.AppendNonNullOrEmpty("beforeShowForm: {0}, ", formView.BeforeShowForm);
            sb.AppendNonNullOrEmpty("onClose: {0}, ", formView.OnClose);

            sb.RemoveLast(COMMA);
            sb.Append("}");
            return sb.ToString();
        }
        private string AccumulateFormDeleteOptions(FormDeleteOptions formDelete)
        {
            if (formDelete == null) return NewLine(6) + "{}";
            var sb = new StringBuilder();
            sb.AppendLine().PadLeft(6);
            sb.Append("{");
            //properties
            sb.AppendNonNullOrEmpty("top: {0}, ", formDelete.Top);
            sb.AppendNonNullOrEmpty("left: {0}, ", formDelete.Left);
            sb.AppendNonNullOrEmpty("width: {0}, ", formDelete.Width);
            sb.AppendNonNullOrEmpty("height: {0}, ", formDelete.Height);
            sb.AppendNonNullOrEmpty("dataheight: {0}, ", formDelete.DataHeight);
            sb.AppendNonNullOrEmpty("modal: {0}, ", ToLowerString(formDelete.Modal));
            sb.AppendNonNullOrEmpty("drag: {0}, ", ToLowerString(formDelete.Drag));
            sb.AppendNonNullOrEmpty("resize: {0}, ", ToLowerString(formDelete.Resize));
            sb.AppendNonNullOrEmpty("url: {0}, ", Asq(formDelete.Url));
            sb.AppendNonNullOrEmpty("mtype: {0}, ", Asq(formDelete.MType));
            sb.AppendNonNullOrEmpty("delData: {0}, ", Asq(formDelete.DelData));
            sb.AppendNonNullOrEmpty("jqModal: {0}, ", ToLowerString(formDelete.JqModal));
            sb.AppendNonNullOrEmpty("delicon: {0}, ", Asq(formDelete.DelIcon));
            sb.AppendNonNullOrEmpty("cancelicon: {0}, ", Asq(formDelete.CancelIcon));
            sb.AppendNonNullOrEmpty("reloadAfterSubmit: {0}, ", ToLowerString(formDelete.ReloadAfterSubmit));
            sb.AppendNonNullOrEmpty("closeOnEscape: {0}, ", ToLowerString(formDelete.CloseOnEscape));
            sb.AppendNonNullOrEmpty("ajaxDelOptions: {0}, ", Asq(formDelete.AjaxDelOptions));
            sb.AppendNonNullOrEmpty("zIndex: {0}, ", formDelete.ZIndex);
            //events
            sb.AppendNonNullOrEmpty("afterComplete: {0}, ", Asq(formDelete.AfterComplete));
            sb.AppendNonNullOrEmpty("afterShowForm: {0}, ", Asq(formDelete.AfterShowForm));
            sb.AppendNonNullOrEmpty("afterSubmit: {0}, ", Asq(formDelete.AfterSubmit));
            sb.AppendNonNullOrEmpty("beforeShowForm: {0}, ", Asq(formDelete.BeforeShowForm));
            sb.AppendNonNullOrEmpty("beforeSubmit: {0}, ", Asq(formDelete.BeforeSubmit));
            sb.AppendNonNullOrEmpty("onclickSubmit: {0}, ", Asq(formDelete.OnclickSubmit));
            sb.AppendNonNullOrEmpty("onClose: {0}, ", Asq(formDelete.OnClose));
            sb.AppendNonNullOrEmpty("errorTextFormat: {0}, ", Asq(formDelete.ErrorTextFormat));
            sb.AppendNonNullOrEmpty("serializeDelData: {0}, ", Asq(formDelete.SerializeDelData));

            sb.RemoveLast(COMMA);
            sb.Append("}");
            return sb.ToString();
        }
        private string AccumulateFormAddEditOptions(FormEditOptions formEdit)
        {

            if (formEdit == null) return NewLine(6) + "{}";
            var sb = new StringBuilder();
            sb.AppendLine().PadLeft(6);
            sb.Append("{");
            //properties
            sb.AppendNonNullOrEmpty("top: {0}, ", formEdit.Top);
            sb.AppendNonNullOrEmpty("left: {0}, ", formEdit.Left);
            sb.AppendNonNullOrEmpty("width: {0}, ", formEdit.Width);
            sb.AppendNonNullOrEmpty("height: {0}, ", formEdit.Height);
            sb.AppendNonNullOrEmpty("dataheight: {0}, ", formEdit.DataHeight);
            sb.AppendNonNullOrEmpty("modal: {0}, ", ToLowerString(formEdit.Modal));
            sb.AppendNonNullOrEmpty("drag: {0}, ", ToLowerString(formEdit.Drag));
            sb.AppendNonNullOrEmpty("resize: {0}, ", ToLowerString(formEdit.Resize));
            sb.AppendNonNullOrEmpty("url: {0}, ", Asq(formEdit.Url));
            sb.AppendNonNullOrEmpty("mtype: {0}, ", Asq(formEdit.MType));
            sb.AppendNonNullOrEmpty("editData: {0}, ", Asq(formEdit.EditData));
            sb.AppendNonNullOrEmpty("recreateForm: {0}, ", ToLowerString(formEdit.RecreateForm));
            sb.AppendNonNullOrEmpty("jqModal: {0}, ", ToLowerString(formEdit.JqModal));
            sb.AppendNonNullOrEmpty("addedrow: {0}, ", Asq(formEdit.Addedrow));
            sb.AppendNonNullOrEmpty("topinfo: {0}, ", Asq(formEdit.TopInfo));
            sb.AppendNonNullOrEmpty("bottominfo: {0}, ", Asq(formEdit.BottomInfo));
            sb.AppendNonNullOrEmpty("saveicon: {0}, ", Asq(formEdit.SaveIcon));
            sb.AppendNonNullOrEmpty("closeicon: {0}, ", Asq(formEdit.CloseIcon));
            sb.AppendNonNullOrEmpty("savekey: {0}, ", formEdit.SaveKey);
            sb.AppendNonNullOrEmpty("navkeys: {0}, ", formEdit.NavKeys);
            sb.AppendNonNullOrEmpty("checkOnSubmit: {0}, ", ToLowerString(formEdit.CheckOnSubmit));
            sb.AppendNonNullOrEmpty("checkOnUpdate: {0}, ", ToLowerString(formEdit.CheckOnUpdate));
            sb.AppendNonNullOrEmpty("closeAfterAdd: {0}, ", ToLowerString(formEdit.CloseAfterAdd));
            sb.AppendNonNullOrEmpty("clearAfterAdd: {0}, ", ToLowerString(formEdit.ClearAfterAdd));
            sb.AppendNonNullOrEmpty("closeAfterEdit: {0}, ", ToLowerString(formEdit.CloseAfterEdit));
            sb.AppendNonNullOrEmpty("reloadAfterSubmit: {0}, ", ToLowerString(formEdit.ReloadAfterSubmit));
            sb.AppendNonNullOrEmpty("closeOnEscape: {0}, ", ToLowerString(formEdit.CloseOnEscape));
            sb.AppendNonNullOrEmpty("ajaxEditOptions: {0}, ", Asq(formEdit.AjaxEditOptions));
            sb.AppendNonNullOrEmpty("viewPagerButtons: {0}, ", ToLowerString(formEdit.ViewPagerButtons));
            sb.AppendNonNullOrEmpty("zIndex: {0}, ", formEdit.ZIndex);
            //events
            sb.AppendNonNullOrEmpty("afterclickPgButtons: {0}, ", formEdit.AfterClickPgButtons);
            sb.AppendNonNullOrEmpty("afterComplete: {0}, ", formEdit.AfterComplete);
            sb.AppendNonNullOrEmpty("afterShowForm: {0}, ", formEdit.AfterShowForm);
            sb.AppendNonNullOrEmpty("afterSubmit: {0}, ", formEdit.AfterSubmit);
            sb.AppendNonNullOrEmpty("beforeCheckValues: {0}, ", formEdit.BeforeCheckValues);
            sb.AppendNonNullOrEmpty("beforeInitData: {0}, ", formEdit.BeforeInitData);
            sb.AppendNonNullOrEmpty("beforeShowForm: {0}, ", formEdit.BeforeShowForm);
            sb.AppendNonNullOrEmpty("beforeSubmit: {0}, ", formEdit.BeforeSubmit);
            sb.AppendNonNullOrEmpty("onclickPgButtons: {0}, ", formEdit.OnclickPgButtons);
            sb.AppendNonNullOrEmpty("onclickSubmit: {0}, ", formEdit.OnclickSubmit);
            sb.AppendNonNullOrEmpty("onInitializeForm: {0}, ", formEdit.OnInitializeForm);
            sb.AppendNonNullOrEmpty("onClose: {0}, ", formEdit.OnClose);
            sb.AppendNonNullOrEmpty("errorTextFormat: {0}, ", formEdit.ErrorTextFormat);
            sb.AppendNonNullOrEmpty("serializeEditData: {0}, ", formEdit.SerializeEditData);

            //Cut off the last comma
            sb.RemoveLast(COMMA);
            sb.Append("}");
            return sb.ToString();
        }
 private string GetEditRules(ColumnEditRules editRules)
 {
     if (editRules == null) return string.Empty;
     var sb = new StringBuilder();
     sb.AppendFormat("editrules:{{ ");
     sb.AppendNonNullOrEmpty("edithidden: {0}, ", ToLowerString(editRules.EditHidden));
     sb.AppendNonNullOrEmpty("required: {0}, ", ToLowerString(editRules.Required));
     sb.AppendNonNullOrEmpty("number: {0}, ", ToLowerString(editRules.Number));
     sb.AppendNonNullOrEmpty("integer: {0}, ", ToLowerString(editRules.Integer));
     sb.AppendNonNullOrEmpty("minValue: {0}, ", editRules.MinValue);
     sb.AppendNonNullOrEmpty("maxValue: {0}, ", editRules.MaxValue);
     sb.AppendNonNullOrEmpty("email: {0}, ", ToLowerString(editRules.Email));
     sb.AppendNonNullOrEmpty("url: {0}, ", ToLowerString(editRules.Url));
     sb.AppendNonNullOrEmpty("date: {0}, ", ToLowerString(editRules.Date));
     sb.AppendNonNullOrEmpty("time: {0}, ", ToLowerString(editRules.Time));
     sb.AppendNonNullOrEmpty("custom: {0}, ", ToLowerString(editRules.Custom));
     sb.AppendNonNullOrEmpty("custom_func: {0}, ", editRules.CustomFunction);
     sb.RemoveLast(COMMA);
     sb.AppendFormat("}}, ");
     return sb.ToString();
 }