예제 #1
0
        protected virtual IEnumerable <ScriptDescriptor> GetScriptDescriptors()
        {
            string colName = "";

            if (this._Columns != null)
            {
                if (_hiddenRowHeader)
                {
                    colName = colName + "{\"name\": \"\",";
                    colName = colName + "\"id\": \"#\",";
                    colName = colName + "\"cssClass\": \"cell-reorder dnd\",";
                    colName = colName + "\"width\": 40},";
                }
                foreach (var r in this._Columns)
                {
                    colName = colName + "{ \"field\": \"" + r.BaseColumn.ToUpper() + "\",";
                    colName = colName + "\"name\": \"" + r.Name + "\",";
                    colName = colName + "\"id\": \"" + r.BaseColumn.ToLower() + "\",";
                    colName = colName + "\"source\":  \"" + r.Source + "\",";
                    colName = colName + "\"width\": \"" + r.Width + "\",";
                    colName = colName + "\"hidden\": \"" + r.Hidden + "\"";
                    if (Until.NVL(r.CssClass) != "")
                    {
                        colName = colName + ",\"cssClass\": \"" + r.CssClass + "\"";
                    }
                    if (r.EditControlType != EditorType.None)
                    {
                        if (r.EditControlType == EditorType.DropGrid)
                        {
                            string colTemp = "";
                            foreach (var temp in r.ItemTemplate)
                            {
                                colTemp = colTemp + "{ \"field\": \"" + temp.BaseColumn.ToUpper() + "\",";
                                colTemp = colTemp + "\"name\": \"" + temp.Name + "\",";
                                colTemp = colTemp + "\"width\": \"" + temp.Width + "\"";
                                colTemp = colTemp + "},";
                            }
                            if (colTemp.Length > 0)
                            {
                                colTemp = colTemp.Substring(0, colTemp.Length - 1);
                                colTemp = "[" + colTemp + "]";
                            }
                            colName = colName + ",\"itemTemplate\": " + colTemp + "";
                        }
                        colName = colName + ",\"editor\": \"" + r.EditControlType.ToString() + "\"";
                    }
                    colName = colName + ",\"lke\": \"" + Until.NVL(r.lke) + "\"";
                    colName = colName + ",\"url\": \"" + Until.NVL(r.UrlReference) + "\"";
                    colName = colName + ",\"dataType\": \"" + Until.NVL(r.DataType.ToString()) + "\"";
                    colName = colName + ",\"maxLength\": \"" + Until.NVL(r.MaxLength.ToString()) + "\"";
                    colName = colName + ",\"upperCase\": \"" + Until.NVL(r.UpperCase.ToString()) + "\"";
                    colName = colName + ",\"dec\": \"" + Until.NVL(r.Dec.ToString()) + "\"";
                    colName = colName + ",\"isEditCell\": \"" + (r.EditControlType == EditorType.None ? r.IsEditCell.ToString() : "true") + "\"";
                    if (!string.IsNullOrEmpty(r.HeaderTemplate))
                    {
                        colName = colName + ",\"headerTemplate\": \"" + Until.NVL(r.HeaderTemplate) + "\"";
                    }
                    colName = colName + ",\"icon\": \"none\"";
                    if (r.Icon != IconType.NONE)
                    {
                        string url      = Base.GetImageURL(r.Icon);
                        string imageUrl = Page.ClientScript.GetWebResourceUrl(this.GetType(), url);
                        colName = colName + ",\"icon\": \"" + imageUrl + "\"";
                    }
                    colName = colName + "},";
                }
            }
            if (colName.Length > 0)
            {
                colName = colName.Substring(0, colName.Length - 1);
                colName = "[" + colName + "]";
            }
            string dataJson = "";

            if (this._DataSource != null)
            {
                dataJson = LibTable.TableToJson(this._DataSource);
            }
            ScriptControlDescriptor descriptor = new ScriptControlDescriptor("Lib.gridView ", this.ClientID);

            descriptor.AddProperty("columns", colName);
            descriptor.AddProperty("dataSource", dataJson);
            descriptor.AddProperty("width", this.Width.ToString());
            descriptor.AddProperty("height", this.Height.ToString());
            descriptor.AddProperty("pageSize", this.GetPageSize().ToString());
            descriptor.AddProperty("onClientCellClick", this.onClientCellClick);
            descriptor.AddProperty("typePaging", this.TypePaging.ToString());
            descriptor.AddProperty("onClientUpdateCell", this.onClientUpdateCell);
            descriptor.AddProperty("onClientBeforEdit", this.onClientBeforEdit);
            descriptor.AddProperty("hidenHeader", this.HidenHeader);
            descriptor.AddProperty("onClientDbClick", this.onClientDbClick);

            return(new ScriptDescriptor[] { descriptor });
        }
예제 #2
0
        protected virtual IEnumerable <ScriptDescriptor> GetScriptDescriptors()
        {
            string colName = "";

            if (this._Columns != null)
            {
                if (_hidenHeader)
                {
                    colName = colName + "{\"name\": \"\",";
                    colName = colName + "\"id\": \"#\",";
                    colName = colName + "\"cssClass\": \"cell-reorder dnd\",";
                    colName = colName + "\"width\": 40},";
                }
                foreach (var r in this._Columns)
                {
                    _widthGrid = _widthGrid + r.Width;
                    colName    = colName + "{ \"field\": \"" + r.BaseColumn.ToUpper() + "\",";
                    colName    = colName + "\"name\": \"" + r.Name + "\",";
                    colName    = colName + "\"id\": \"" + r.BaseColumn.ToLower() + "\",";
                    colName    = colName + "\"source\":  \"" + r.Source + "\",";
                    colName    = colName + "\"width\": \"" + r.Width + "\",";
                    colName    = colName + "\"hidden\": \"" + r.Hidden + "\"";
                    if (Until.NVL(r.CssClass) != "")
                    {
                        colName = colName + ",\"cssClass\": \"" + r.CssClass + "\"";
                    }
                    if (r.EditControlType != EditorType.None)
                    {
                        colName = colName + ",\"editor\": \"" + r.EditControlType.ToString() + "\"";
                    }

                    colName = colName + ",\"lke\": \"" + Until.NVL(r.lke) + "\"";
                    colName = colName + ",\"url\": \"" + Until.NVL(r.UrlReference) + "\"";
                    colName = colName + ",\"dataType\": \"" + Until.NVL(r.DataType.ToString()) + "\"";
                    colName = colName + ",\"maxLength\": \"" + Until.NVL(r.MaxLength.ToString()) + "\"";
                    colName = colName + ",\"upperCase\": \"" + Until.NVL(r.UpperCase.ToString()) + "\"";
                    colName = colName + ",\"dec\": \"" + Until.NVL(r.Dec.ToString()) + "\"";
                    colName = colName + ",\"isEditCell\": \"" + (r.EditControlType == EditorType.None ? r.IsEditCell.ToString() : "true") + "\"";
                    if (!string.IsNullOrEmpty(r.HeaderTemplate))
                    {
                        colName = colName + ",\"headerTemplate\": \"" + Until.NVL(r.HeaderTemplate) + "\"";
                    }
                    colName = colName + ",\"icon\": \"none\"";
                    if (r.Icon != IconType.NONE)
                    {
                        string url      = Base.GetImageURL(r.Icon);
                        string imageUrl = Page.ClientScript.GetWebResourceUrl(this.GetType(), url);
                        colName = colName + ",\"icon\": \"" + imageUrl + "\"";
                    }
                    colName = colName + "},";
                }
            }
            if (colName.Length > 0)
            {
                colName = colName.Substring(0, colName.Length - 1);
                colName = "[" + colName + "]";
            }
            string dataJson = "";

            if (this._DataSource != null)
            {
                dataJson = LibTable.TableToJson(this._DataSource);
            }

            ScriptControlDescriptor descriptor = new ScriptControlDescriptor("Lib.dropdowGrid", this.ClientID);

            descriptor.AddProperty("Name", this.Name.ToString());
            descriptor.AddProperty("columns", colName);
            descriptor.AddProperty("dataSource", dataJson);
            descriptor.AddProperty("multiCheck", _multiCheck.ToString());
            descriptor.AddProperty("pageSize", _Frame[0].PageSize.ToString());
            descriptor.AddProperty("dataValue", DataValue);
            descriptor.AddProperty("displayValue", DisplayValue);
            descriptor.AddProperty("onClientSelectItem", OnClientSelectItem);
            return(new ScriptDescriptor[] { descriptor });
        }