Exemplo n.º 1
0
        public GridEditColumnBuilder <T> CheckBoxFor(string name, Func <T, bool> func)
        {
            var column = new GridCheckBoxColumn <T>(GridModel, name, func);

            GridModel.ColumnList.Add(column);
            return(new GridEditColumnBuilder <T>(column));
        }
Exemplo n.º 2
0
        public GridCheckBoxColumn AddCheckBoxColumn(string dataField, string headerText)
        {
            GridCheckBoxColumn c = new GridCheckBoxColumn();

            _grid.MasterTableView.Columns.Add(c);
            c.DataField  = dataField;
            c.HeaderText = headerText;
            return(c);
        }
Exemplo n.º 3
0
        public override void AttachProperties(GridColumn gridColumn)
        {
            base.AttachProperties(gridColumn);

            GridCheckBoxColumn column = (GridCheckBoxColumn)gridColumn;

            column.DataField = DataFieldKey;
            column.ReadOnly  = IsReadOnly;
        }
Exemplo n.º 4
0
        /// <summary>
        ///   Formats a Grid Column based on the Settings
        /// </summary>
        /// <param name = "setting"></param>
        public static GridColumn FormatGridColumn(GridViewColumn setting)
        {
            GridColumn column;

            switch (setting.Type.ToLower())
            {
            case "image":
                column = new GridImageColumn();
                //((GridImageColumn)column) = new Bitmap(1, 1);   // Default empty Image
                break;

            case "process":
                column = new GridPercentColumn();
                break;

            case "check":
                column = new GridCheckBoxColumn();
                break;

            case "rating":
                //column = new DataGridViewRatingColumn();
                column = new GridTextColumn();
                break;

            default:
                column = new GridTextColumn();
                break;
            }

            column.HeaderText = setting.Title;
            column.IsReadOnly = setting.Readonly;
            column.IsHidden   = !setting.Display;
            column.Width      = setting.Width;
            //column.IsFrozen = setting.Frozen;
            // For columns bound to a data Source set the property
            //if (setting.Bound)
            //{
            column.MappingName = setting.Name;
            //}

            switch (setting.Type.ToLower())
            {
            case "text":
            case "process":
                //  column.ValueType = typeof(string);
                break;

            case "number":
            case "check":
            case "rating":
                //  column.ValueType = typeof(int);
                break;
            }

            return(column);
        }
Exemplo n.º 5
0
        private void CargarRadGrid2()
        {
            //DataTable dt = new DataTable();
            DataSet dsAccionesModulos = new DataSet();
            //DataTable dtAcciones = new DataTable();
            DataTable dtModulos = new DataTable();
            string    mensaje   = string.Empty;

            dsAccionesModulos = perfiles.ModuloConsultar(ref mensaje);

            if (!mensaje.Equals(string.Empty))
            {
                (this.Master as Principal).AlertError(mensaje);
            }

            //Dividir tablas de consulta
            dtAcciones          = dsAccionesModulos.Tables[0];
            RadGrid3.DataSource = dtAcciones == null ? new DataTable() : dtAcciones;
            RadGrid3.DataBind();

            dtModulos = dsAccionesModulos.Tables[1];

            //Agregar columnas al RadGrid2
            GridCheckBoxColumn boundColumn1;

            foreach (DataRow drAccion in dtAcciones.Rows)
            {
                string sAccion = drAccion["Accion"].ToString();
                if (RadGrid2.MasterTableView.Columns.Contains(sAccion))
                {
                    continue;
                }

                boundColumn1 = new GridCheckBoxColumn();
                RadGrid2.MasterTableView.Columns.Add(boundColumn1);
                boundColumn1.DataField                 = sAccion;
                boundColumn1.ToolTip                   = sAccion;
                boundColumn1.HeaderText                = sAccion;
                boundColumn1.UniqueName                = sAccion.Replace(" ", "");
                boundColumn1.HeaderStyle.Width         = 70;
                boundColumn1.ItemStyle.HorizontalAlign = HorizontalAlign.Center;
                boundColumn1.Visible                   = true;
            }

            RadGrid2.DataSource = dtModulos == null ? new DataTable() : dtModulos;
            RadGrid2.DataBind();
            CargarAcciones();
        }
        public Form1()
        {
            InitializeComponent();

            sfDataGrid.AutoGenerateColumns = false;
            sfDataGrid.DataSource          = new ViewModel().Orders;
            sfDataGrid.LiveDataUpdateMode  = LiveDataUpdateMode.AllowDataShaping;
            sfDataGrid.AllowEditing        = true;
            sfDataGrid.AutoSizeColumnsMode = AutoSizeColumnsMode.AllCells;
            sfDataGrid.AddNewRowPosition   = RowPosition.Top;
            GridNumericColumn gridTextColumn1 = new GridNumericColumn()
            {
                MappingName = "OrderID", HeaderText = "Order ID"
            };
            GridTextColumn gridTextColumn2 = new GridTextColumn()
            {
                MappingName = "CustomerID", HeaderText = "Customer ID", AllowEditing = true
            };
            GridTextColumn gridTextColumn3 = new GridTextColumn()
            {
                MappingName = "CustomerName", HeaderText = "Customer Name"
            };
            GridTextColumn gridTextColumn4 = new GridTextColumn()
            {
                MappingName = "Country", HeaderText = "Country"
            };
            GridTextColumn gridTextColumn5 = new GridTextColumn()
            {
                MappingName = "ShipCity", HeaderText = "Ship City"
            };
            GridCheckBoxColumn checkBoxColumn = new GridCheckBoxColumn()
            {
                MappingName = "IsShipped", HeaderText = "Is Shipped"
            };

            // enable the context menu for new records
            sfDataGrid.RecordContextMenu = new ContextMenuStrip();
            sfDataGrid.RecordContextMenu.Items.Add("Copy", null, OnBuscarMenuClicked);

            sfDataGrid.Columns.Add(gridTextColumn1);
            sfDataGrid.Columns.Add(gridTextColumn2);
            sfDataGrid.Columns.Add(gridTextColumn3);
            sfDataGrid.Columns.Add(gridTextColumn4);
            sfDataGrid.Columns.Add(gridTextColumn5);
            sfDataGrid.Columns.Add(checkBoxColumn);
            sfDataGrid.TableControl.MouseUp += SfDataGrid_MouseUp;
        }
Exemplo n.º 7
0
        public Form1()
        {
            InitializeComponent();

            sfDataGrid.AutoGenerateColumns = false;
            sfDataGrid.DataSource          = new ViewModel().Orders;
            sfDataGrid.ShowRowHeader       = true;
            sfDataGrid.LiveDataUpdateMode  = LiveDataUpdateMode.AllowDataShaping;
            sfDataGrid.ShowGroupDropArea   = true;

            GridTextColumn gridTextColumn1 = new GridTextColumn()
            {
                MappingName = "OrderID", HeaderText = "Order ID"
            };
            GridTextColumn gridTextColumn2 = new GridTextColumn()
            {
                MappingName = "CustomerID", HeaderText = "Customer ID"
            };
            GridTextColumn gridTextColumn3 = new GridTextColumn()
            {
                MappingName = "CustomerName", HeaderText = "Customer Name"
            };
            GridTextColumn gridTextColumn4 = new GridTextColumn()
            {
                MappingName = "Country", HeaderText = "Country"
            };
            GridTextColumn gridTextColumn5 = new GridTextColumn()
            {
                MappingName = "ShipCity", HeaderText = "Ship City"
            };
            GridCheckBoxColumn checkBoxColumn = new GridCheckBoxColumn()
            {
                MappingName = "IsShipped", HeaderText = "Is Shipped"
            };

            sfDataGrid.Columns.Add(gridTextColumn1);
            sfDataGrid.Columns.Add(gridTextColumn2);
            sfDataGrid.Columns.Add(gridTextColumn3);
            sfDataGrid.Columns.Add(gridTextColumn4);
            sfDataGrid.Columns.Add(gridTextColumn5);
            sfDataGrid.Columns.Add(checkBoxColumn);
            btnExportExcel.Click += BtnExportExcel_Click;
            sfDataGrid.DrawCell  += SfDataGrid_DrawCell;
        }
Exemplo n.º 8
0
        public Form1()
        {
            InitializeComponent();
            //To add custom renderer into SfDataGrid.
            this.sfDataGrid.CellRenderers.Add("TextButton", new GridTextButtonCellRenderer(this.sfDataGrid));
            sfDataGrid.AutoGenerateColumns = false;
            sfDataGrid.DataSource          = new ViewModel().Orders;
            sfDataGrid.LiveDataUpdateMode  = LiveDataUpdateMode.AllowDataShaping;

            GridTextColumn gridTextColumn1 = new GridTextColumn()
            {
                MappingName = "OrderID", HeaderText = "Order ID"
            };
            GridTextColumn gridTextColumn3 = new GridTextColumn()
            {
                MappingName = "CustomerName", HeaderText = "Customer Name"
            };
            GridTextColumn gridTextColumn4 = new GridTextColumn()
            {
                MappingName = "Country", HeaderText = "Country"
            };
            GridTextColumn gridTextColumn5 = new GridTextColumn()
            {
                MappingName = "ShipCity", HeaderText = "Ship City"
            };
            GridCheckBoxColumn checkBoxColumn = new GridCheckBoxColumn()
            {
                MappingName = "IsShipped", HeaderText = "Is Shipped"
            };

            //To add TextButtonColumn in grid
            this.sfDataGrid.Columns.Add(new GridTextButtonColumn()
            {
                MappingName = "CustomerID", Width = 140
            });


            sfDataGrid.Columns.Add(gridTextColumn1);
            sfDataGrid.Columns.Add(gridTextColumn3);
            sfDataGrid.Columns.Add(gridTextColumn4);
            sfDataGrid.Columns.Add(gridTextColumn5);
            sfDataGrid.Columns.Add(checkBoxColumn);
        }
Exemplo n.º 9
0
        private GridColumn CreateSfColumn(Field field, int i)
        {
            GridColumn result;

            DataType t = field.SchemaType == SchemaType.Data
            ? ((DataField)field).DataType
            : DataType.String;

            if (t == DataType.Int32 ||
                t == DataType.Float ||
                t == DataType.Double ||
                t == DataType.Decimal)
            {
                result = new GridNumericColumn();
            }
            else if (t == DataType.DateTimeOffset)
            {
                result = new GridDateTimeColumn();
            }
            else if (t == DataType.Boolean)
            {
                result = new GridCheckBoxColumn();
            }
            else
            {
                result = new GridTextColumn()
                {
                    TextWrapping = TextWrapping.NoWrap
                };
            }

            result.MappingName    = $"[{i}]";
            result.HeaderText     = field.Name;
            result.AllowFiltering = false;
            result.AllowFocus     = true;
            result.AllowResizing  = true;
            result.AllowSorting   = true;
            result.FilterBehavior = FilterBehavior.StronglyTyped;
            result.AllowEditing   = true;

            return(result);
        }
Exemplo n.º 10
0
        private GridColumn CreateSfColumn(Series s, int i)
        {
            GridColumn result;

            if (s.DataType == typeof(int) ||
                s.DataType == typeof(float) ||
                s.DataType == typeof(double) ||
                s.DataType == typeof(decimal))
            {
                result = new GridNumericColumn();
            }
            else if (s.DataType == typeof(DateTime) ||
                     s.DataType == typeof(DateTimeOffset))
            {
                result = new GridDateTimeColumn();
            }
            else if (s.DataType == typeof(bool))
            {
                result = new GridCheckBoxColumn();
            }
            else
            {
                result = new GridTextColumn();
            }

            result.MappingName    = $"[{i}]";
            result.HeaderText     = s.Name;
            result.AllowFiltering = false;
            result.AllowFocus     = true;
            result.AllowResizing  = true;
            result.AllowSorting   = true;
            result.FilterBehavior = FilterBehavior.StronglyTyped;
            result.AllowEditing   = true;

            result.ShowToolTip = false;

            result.ShowHeaderToolTip     = true;
            result.HeaderToolTipTemplate = _headerTooltipTemplate;

            return(result);
        }
        private GridColumn CreateSfColumn(SchemaElement se, int i)
        {
            GridColumn result;

            if (se.ElementType == typeof(int) ||
                se.ElementType == typeof(float) ||
                se.ElementType == typeof(double) ||
                se.ElementType == typeof(decimal))
            {
                result = new GridNumericColumn();
            }
            else if (se.ElementType == typeof(DateTime) ||
                     se.ElementType == typeof(DateTimeOffset))
            {
                result = new GridDateTimeColumn();
            }
            else if (se.ElementType == typeof(bool))
            {
                result = new GridCheckBoxColumn();
            }
            else
            {
                result = new GridTextColumn();
            }

            result.MappingName    = $"[{i}]";
            result.HeaderText     = se.Name;
            result.AllowFiltering = false;
            result.AllowFocus     = true;
            result.AllowResizing  = true;
            result.AllowSorting   = true;
            result.FilterBehavior = FilterBehavior.StronglyTyped;
            result.AllowEditing   = true;

            return(result);
        }
        public static void BindTelerikGrid(
            ref RadGrid Grid
            , DataTable Dt_Source
            , List<ClsBindGridColumn_Web_Telerik> List_Gc
            , string Key = ""
            , bool AllowSort = true
            , bool HasDelete = false
            , eSelectorType SelectorType = eSelectorType.None
            )
        {
            Grid.DataSource = Dt_Source;

            if (Grid.Columns.Count > 0)
            { Grid.Columns.Clear(); }

            Grid.AutoGenerateColumns = false;
            if (SelectorType != eSelectorType.None)
            {
                Grid.ClientSettings.Selecting.AllowRowSelect = true;
                Grid.ClientSettings.Selecting.UseClientSelectColumnOnly = true;
            }

            Grid.AllowMultiRowSelection = SelectorType == eSelectorType.Multiple;

            //Grid.ClientSettings.Resizing.AllowColumnResize = true;
            //Grid.ClientSettings.Resizing.AllowResizeToFit = true;

            TableItemStyle Tis  = null;

            foreach (ClsBindGridColumn_Web_Telerik Inner_Gc in List_Gc)
            {
                if (!Inner_Gc.mIsVisible)
                {
                    continue;
                }

                switch (Inner_Gc.mFieldType)
                {
                    case Layer01_Constants.eSystem_Lookup_FieldType.FieldType_Text:
                    {
                        GridBoundColumn Gc = new GridBoundColumn();
                        Grid.Columns.Add(Gc);

                        Gc.HeaderStyle.Width = Inner_Gc.mUnit_Width;
                        Gc.HeaderText = Inner_Gc.mFieldDesc;
                        Gc.DataField = Inner_Gc.mFieldName;
                        Gc.ReadOnly = !Inner_Gc.mEnabled;
                        Gc.DataFormatString = Inner_Gc.mDataFormat;

                        if (AllowSort)
                        { Gc.HeaderButtonType = GridHeaderButtonType.LinkButton; }

                        Gc.SortExpression = Inner_Gc.mFieldName;
                        Tis = Gc.ItemStyle;

                        break;
                    }

                    case Layer01_Constants.eSystem_Lookup_FieldType.FieldType_Checkbox:
                    {
                        GridCheckBoxColumn Gc = new GridCheckBoxColumn();
                        Grid.Columns.Add(Gc);

                        Gc.HeaderStyle.Width = Inner_Gc.mUnit_Width;
                        Gc.DataField = Inner_Gc.mFieldName;
                        Gc.HeaderText = Inner_Gc.mFieldDesc;
                        Gc.ReadOnly = !Inner_Gc.mEnabled;

                        if (AllowSort)
                        { Gc.HeaderButtonType = GridHeaderButtonType.LinkButton; }

                        Gc.SortExpression = Inner_Gc.mFieldName;
                        Tis = Gc.ItemStyle;

                        break;
                    }

                    case Layer01_Constants.eSystem_Lookup_FieldType.FieldType_DateTime:
                    {
                        GridDateTimeColumn Gc = new Telerik.Web.UI.GridDateTimeColumn();
                        Grid.Columns.Add(Gc);

                        Gc.HeaderStyle.Width = Inner_Gc.mUnit_Width;
                        Gc.DataField = Inner_Gc.mFieldName;
                        Gc.HeaderText = Inner_Gc.mFieldDesc;
                        Gc.ReadOnly = !Inner_Gc.mEnabled;
                        Gc.DataFormatString = Inner_Gc.mDataFormat;

                        if (AllowSort)
                        { Gc.HeaderButtonType = GridHeaderButtonType.LinkButton; }

                        Gc.SortExpression = Inner_Gc.mFieldName;
                        Tis = Gc.ItemStyle;

                        break;
                    }

                    case Layer01_Constants.eSystem_Lookup_FieldType.FieldType_Button:
                    {
                        GridButtonColumn Gc = new GridButtonColumn();
                        Grid.Columns.Add(Gc);

                        Gc.HeaderStyle.Width = Inner_Gc.mUnit_Width;
                        Gc.HeaderText = Inner_Gc.mFieldDesc;
                        Gc.CommandName = Inner_Gc.mCommandName;

                        if (Inner_Gc.mFieldName == "")
                        { Gc.Text = Inner_Gc.mFieldText; }
                        else
                        { Gc.DataTextField = Inner_Gc.mFieldName; }

                        switch (Inner_Gc.mButtonType)
                        {
                            case ButtonColumnType.PushButton:
                                Gc.ButtonType = Telerik.Web.UI.GridButtonColumnType.PushButton;
                                break;
                            case ButtonColumnType.LinkButton:
                                Gc.ButtonType = Telerik.Web.UI.GridButtonColumnType.LinkButton;
                                break;
                        }

                        Tis = Gc.ItemStyle;
                        break;
                    }
                    case Layer01_Constants.eSystem_Lookup_FieldType.FieldType_HyperLink:
                    {
                        GridHyperLinkColumn Gc = new GridHyperLinkColumn();
                        Grid.Columns.Add(Gc);

                        Gc.HeaderStyle.Width = Inner_Gc.mUnit_Width;
                        Gc.HeaderText = Inner_Gc.mFieldDesc;
                        Gc.Text = Inner_Gc.mFieldText;
                        Gc.DataNavigateUrlFormatString = Inner_Gc.mFieldNavigateUrl_Text;
                        Gc.DataNavigateUrlFields = new string[] { Inner_Gc.mFieldNavigateUrl_Field };

                        Tis = Gc.ItemStyle;
                        break;
                    }
                    default:
                    {
                        GridBoundColumn Gc = new GridBoundColumn();
                        Grid.Columns.Add(Gc);

                        Gc.HeaderStyle.Width = Inner_Gc.mUnit_Width;
                        Gc.HeaderText = Inner_Gc.mFieldDesc;
                        Gc.DataField = Inner_Gc.mFieldName;
                        Gc.ReadOnly = true;
                        Gc.DataFormatString = Inner_Gc.mDataFormat;

                        if (AllowSort)
                        { Gc.HeaderButtonType = GridHeaderButtonType.LinkButton; }

                        Tis = Gc.ItemStyle;

                        break;
                    }
                }

                //Tis.Width = Inner_Gc.mUnit_Width;
            }

            if (HasDelete) { }

            switch (SelectorType)
            {
                case eSelectorType.Single:
                case eSelectorType.Multiple:
                    {
                        GridClientSelectColumn Gc = new GridClientSelectColumn();
                        Grid.Columns.Insert(0, Gc);
                        Gc.UniqueName = "Select";
                        Gc.HeaderText = "";
                        Gc.HeaderStyle.Width = new Unit("40px");
                        break;
                    }
            }

            if (Key != "")
            { Grid.MasterTableView.DataKeyNames = new string[] { Key }; }

            Grid.DataBind();
        }
Exemplo n.º 13
0
        public static void GenerateColumnsSfDataGrid(SfDataGrid dataGrid, DataTable table, string prefab)
        {
            using (var conn = new SqlConnection(App.ConnectionString))
            {
                conn.Open();
                if (!string.IsNullOrEmpty(prefab))
                {
                    DataTable prefabTable = App.GetPrefabDataTable(conn, $"{App.Settings["Schema"]}_PREFABS", prefab);
                    DataTable comboTable  =
                        App.GetPrefabDataTable(conn, $"{App.Settings["Schema"]}_COMBOBOXES", prefab);

                    //could loop by table.ColumnNames.Count; but if prebab is changed... problems; maybe not all columns showing
                    for (var i = 0; i < table.Columns.Count; i++)
                    {
                        GridColumn column;

                        try
                        {
                            if (prefabTable.Rows[i]["TYPES"].ToString().ToLower().Equals("autocomplete"))
                            {
                                var comboStrings = new HashSet <string>();
                                for (var j = 0; j < comboTable.Rows.Count; j++)
                                {
                                    if (!string.IsNullOrEmpty(
                                            comboTable.Rows[j][prefabTable.Rows[i]["COLUMNS"].ToString()].ToString()))
                                    {
                                        comboStrings.Add(comboTable.Rows[j][prefabTable.Rows[i]["COLUMNS"].ToString()]
                                                         .ToString());
                                    }
                                }

                                StringBuilder sb1 = new StringBuilder();
                                sb1.AppendLine(
                                    "<DataTemplate xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/presentation\" xmlns:x=\"http://schemas.microsoft.com/winfx/2006/xaml\">");
                                sb1.AppendLine("<ComboBox PlaceholderText=\"{Binding " + prefabTable.Rows[i]["COLUMNS"] +
                                               ", Mode=TwoWay}\" IsEditable=\"True\" IsTextSearchEnabled=\"True\" IsDropDownOpen=\"True\" >");
                                foreach (var comboString in comboStrings)
                                {
                                    sb1.AppendLine($"<x:String>{comboString}</x:String>");
                                }
                                sb1.AppendLine("</ComboBox>");
                                sb1.AppendLine("</DataTemplate>");
                                DataTemplate cellTemplate = (DataTemplate)XamlReader.Load(sb1.ToString());
                                column = new GridTemplateColumn
                                {
                                    MappingName  = table.Columns[i].ColumnName,
                                    HeaderText   = prefabTable.Rows[i]["COLUMNS"].ToString(),
                                    EditTemplate = cellTemplate
                                };
                                dataGrid.Columns.Add(column);
                            }
                            else if (prefabTable.Rows[i]["TYPES"].ToString().ToLower().Equals("datepicker"))
                            {
                                column = new GridDateTimeColumn
                                {
                                    MappingName        = table.Columns[i].ColumnName,
                                    FormatString       = "MM/dd/yyyy",
                                    AllowInlineEditing = true,
                                    AllowNullValue     = true,
                                    HeaderText         = prefabTable.Rows[i]["COLUMNS"].ToString(),
                                    WaterMark          = string.Empty
                                };

                                dataGrid.Columns.Add(column);
                            }
                            else if (prefabTable.Rows[i]["TYPES"].ToString().ToLower().Equals("checkbox"))
                            {
                                column = new GridCheckBoxColumn
                                {
                                    MappingName  = table.Columns[i].ColumnName,
                                    IsThreeState = false,
                                    HeaderText   = prefabTable.Rows[i]["COLUMNS"].ToString()
                                };

                                dataGrid.Columns.Add(column);
                            }
                            else if (prefabTable.Rows[i]["TYPES"].ToString().ToLower().Equals("numeric"))
                            {
                                column = new GridNumericColumn
                                {
                                    MappingName = table.Columns[i].ColumnName,
                                    HeaderText  = prefabTable.Rows[i]["COLUMNS"].ToString(),
                                    MaximumNumberDecimalDigits = 3
                                };

                                dataGrid.Columns.Add(column);
                            }                            /*
                                                          * else if (prefabTable.Rows[i]["TYPES"].ToString().ToLower().Equals("currency"))
                                                          * {
                                                          *     column = new GridCurrencyColumn
                                                          *     {
                                                          *             MappingName = table.Columns[i].ColumnName,
                                                          *             HeaderText = prefabTable.Rows[i]["COLUMNS"].ToString()
                                                          *     };
                                                          *
                                                          *     dataGrid.Columns.Add(column);
                                                          * }*/
                            else if (prefabTable.Rows[i]["TYPES"].ToString().ToLower().Equals("hyperlink"))
                            {
                                column = new GridHyperlinkColumn
                                {
                                    MappingName = table.Columns[i].ColumnName,
                                    HeaderText  = prefabTable.Rows[i]["COLUMNS"].ToString()
                                };

                                dataGrid.Columns.Add(column);
                            }                            /*
                                                          * else if (prefabTable.Rows[i]["TYPES"].ToString().ToLower().Equals("percentage"))
                                                          * {
                                                          *     column = new GridPercentColumn
                                                          *     {
                                                          *             MappingName = table.Columns[i].ColumnName,
                                                          *             HeaderText = prefabTable.Rows[i]["COLUMNS"].ToString()
                                                          *     };
                                                          *
                                                          *     dataGrid.Columns.Add(column);
                                                          * }*/
                            else if (prefabTable.Rows[i]["TYPES"].ToString().ToLower().Equals("combobox"))
                            {
                                var comboStrings = new HashSet <string>();
                                for (var j = 0; j < comboTable.Rows.Count; j++)
                                {
                                    if (!string.IsNullOrEmpty(
                                            comboTable.Rows[j][prefabTable.Rows[i]["COLUMNS"].ToString()].ToString()))
                                    {
                                        comboStrings.Add(comboTable.Rows[j][prefabTable.Rows[i]["COLUMNS"].ToString()]
                                                         .ToString());
                                    }
                                }

                                column = new GridComboBoxColumn
                                {
                                    MappingName = table.Columns[i].ColumnName,
                                    ItemsSource = comboStrings,
                                    HeaderText  = prefabTable.Rows[i]["COLUMNS"].ToString()
                                };

                                dataGrid.Columns.Add(column);
                            }
                            else
                            {
                                column = new GridTextColumn
                                {
                                    MappingName = table.Columns[i].ColumnName,
                                    HeaderText  = prefabTable.Rows[i]["COLUMNS"].ToString()
                                };

                                dataGrid.Columns.Add(column);
                            }                             //TODO: More? CalendarDatePicker, TimePicker, DatePicker, Slider, ToggleSwitch, RichEditBox, PasswordBox, ColorPicker, ComboBox, RatingControl
                        }
                        catch
                        {
                            column = new GridTextColumn
                            {
                                MappingName = table.Columns[i].ColumnName,
                                HeaderText  = table.Columns[i].ColumnName
                            };

                            dataGrid.Columns.Add(column);
                        }
                    }
                }
                else
                {
                    foreach (DataColumn column in table.Columns)
                    {
                        GridColumn gridColumn = new GridTextColumn
                        {
                            MappingName = column.ColumnName,
                            HeaderText  = column.ColumnName
                        };

                        dataGrid.Columns.Add(gridColumn);
                    }
                }

                conn.Close();
            }
        }
Exemplo n.º 14
0
        protected void gv_presencia_ColumnCreated(object sender, GridColumnCreatedEventArgs e)
        {
            if (e.Column.UniqueName == "nodocomercial")
            {
                e.Column.Visible = false;
                GridBoundColumn boundColumn = e.Column as GridBoundColumn;
                boundColumn.ReadOnly = true;
                //boundColumn.DataFormatString = "{0:d}";
            }
            else if (e.Column.UniqueName == "Ciudad")
            {
                GridBoundColumn boundColumn = e.Column as GridBoundColumn;
                boundColumn.ReadOnly = true;
            }
            else if (e.Column.UniqueName == "Mercaderista")
            {
                GridBoundColumn boundColumn = e.Column as GridBoundColumn;
                boundColumn.ReadOnly = true;
            }
            else if (e.Column.UniqueName == "Supervisoras")
            {
                GridBoundColumn boundColumn = e.Column as GridBoundColumn;
                boundColumn.ReadOnly = true;
            }
            else if (e.Column.UniqueName == "Direccion")
            {
                e.Column.Visible = false;
                GridBoundColumn boundColumn = e.Column as GridBoundColumn;
                boundColumn.ReadOnly = true;
            }
            else if (e.Column.UniqueName == "Distrito")
            {
                e.Column.Visible = false;
                GridBoundColumn boundColumn = e.Column as GridBoundColumn;
                boundColumn.ReadOnly = true;
            }
            else if (e.Column.UniqueName == "Dni/Ruc")
            {
                e.Column.Visible = false;
                GridBoundColumn boundColumn = e.Column as GridBoundColumn;
                boundColumn.ReadOnly = true;
            }
            else if (e.Column.UniqueName == "Telefono")
            {
                e.Column.Visible = false;
                GridBoundColumn boundColumn = e.Column as GridBoundColumn;
                boundColumn.ReadOnly = true;
            }
            else if (e.Column.UniqueName == "Distribuidora")
            {
                e.Column.Visible = false;
                GridBoundColumn boundColumn = e.Column as GridBoundColumn;
                boundColumn.ReadOnly = true;
            }
            else if (e.Column.UniqueName == "CodDistrib")
            {
                e.Column.Visible = false;
                GridBoundColumn boundColumn = e.Column as GridBoundColumn;
                boundColumn.ReadOnly = true;
            }
            else if (e.Column.UniqueName == "opreport")
            {
                e.Column.Visible = false;
                GridBoundColumn boundColumn = e.Column as GridBoundColumn;
                boundColumn.ReadOnly = true;
            }
            else if (e.Column.UniqueName == "id_mercaderista")
            {
                e.Column.Visible = false;
                GridBoundColumn boundColumn = e.Column as GridBoundColumn;
                boundColumn.ReadOnly = true;
            }
            else if (e.Column.UniqueName == "PDV_Client")
            {
                GridBoundColumn boundColumn = e.Column as GridBoundColumn;
                boundColumn.ReadOnly = true;
            }
            else if (e.Column.UniqueName == "Total Dis")
            {
                GridBoundColumn boundColumn = e.Column as GridBoundColumn;
                boundColumn.ReadOnly = true;
            }
            else if (e.Column.UniqueName == "% Distb")
            {
                GridBoundColumn boundColumn = e.Column as GridBoundColumn;
                boundColumn.ReadOnly = true;
            }
            else if (e.Column.UniqueName == "% Distb  ")
            {
                GridBoundColumn boundColumn = e.Column as GridBoundColumn;
                boundColumn.ReadOnly = true;
            }
            else if (e.Column.UniqueName == "01 A 07 SKUs")
            {
                GridBoundColumn boundColumn = e.Column as GridBoundColumn;
                boundColumn.ReadOnly = true;
            }
            else if (e.Column.UniqueName == "08 A 13 SKUs")
            {
                GridBoundColumn boundColumn = e.Column as GridBoundColumn;
                boundColumn.ReadOnly = true;
            }
            else if (e.Column.UniqueName == "14 A 17 SKUs")
            {
                GridBoundColumn boundColumn = e.Column as GridBoundColumn;
                boundColumn.ReadOnly = true;
            }
            else if (e.Column.UniqueName == "18 A Más SKUs")
            {
                GridBoundColumn boundColumn = e.Column as GridBoundColumn;
                boundColumn.ReadOnly = true;
            }
            else if (e.Column.UniqueName == "18 A 20 SKUs ")
            {
                GridBoundColumn boundColumn = e.Column as GridBoundColumn;
                boundColumn.ReadOnly = true;
            }
            else if (e.Column.UniqueName == "Mercado")
            {
                GridBoundColumn boundColumn = e.Column as GridBoundColumn;
                boundColumn.ReadOnly = true;
            }
            else if (e.Column.UniqueName == "Cliente")
            {
                GridBoundColumn boundColumn = e.Column as GridBoundColumn;
                boundColumn.ReadOnly = true;
            }
            else if (e.Column.UniqueName == "createby")
            {
                GridBoundColumn boundColumn = e.Column as GridBoundColumn;
                boundColumn.ReadOnly = true;
            }
            else if (e.Column.UniqueName == "dateby")
            {
                GridDateTimeColumn boundColumn = e.Column as GridDateTimeColumn;
                boundColumn.ReadOnly = true;
                if (boundColumn != null)
                {
                    boundColumn.DataFormatString = "{0:dd/MM/yy}";
                }
            }
            else if (e.Column.UniqueName == "modiby")
            {
                GridBoundColumn boundColumn = e.Column as GridBoundColumn;
                boundColumn.ReadOnly = true;
            }
            else if (e.Column.UniqueName == "datemodiby")
            {
                GridDateTimeColumn boundColumn = e.Column as GridDateTimeColumn;
                boundColumn.ReadOnly = true;
                if (boundColumn != null)
                {
                    boundColumn.DataFormatString = "{0:dd/MM/yy}";
                }
            }
            else if (e.Column.UniqueName == "validado")
            {
                e.Column.Visible = false;
                GridCheckBoxColumn boundColumn = e.Column as GridCheckBoxColumn;
                boundColumn.ReadOnly = true;
            }
            else if (e.Column.UniqueName == "Fecha")
            {
                GridDateTimeColumn boundColumn = e.Column as GridDateTimeColumn;
                if (boundColumn != null)
                {
                    boundColumn.DataFormatString = "{0:dd/MM/yy}";
                }
            }
            else
            {
                GridBoundColumn boundColumn = e.Column as GridBoundColumn;
                if (boundColumn != null && TipoReporte.Equals("04"))
                {
                    boundColumn.DataFormatString = "{0:C}";
                }

                if (boundColumn != null && TipoReporte.Equals("05"))
                {
                    boundColumn.DataFormatString = "{0:C}";
                }
                //boundColumn.DataFormatString = "{0:S/.####.##}";
            }
            #region Presencia_Colgate
            if (TipoReporte.Equals("04") || TipoReporte.Equals("0"))
            {
                if (e.Column.UniqueName == "nodocomercial_Calc")
                {
                    e.Column.Visible = false;
                    GridBoundColumn boundColumn = e.Column as GridBoundColumn;
                    boundColumn.ReadOnly = true;
                }
                else if (e.Column.UniqueName == "PDV_Client_Calc")
                {
                    e.Column.Visible = false;
                    GridBoundColumn boundColumn = e.Column as GridBoundColumn;
                    boundColumn.ReadOnly = true;
                }
                else if (e.Column.UniqueName == "fec_reg_cel_Calc")
                {
                    e.Column.Visible = false;
                    GridBoundColumn boundColumn = e.Column as GridBoundColumn;
                    boundColumn.ReadOnly = true;
                }
                else if (e.Column.UniqueName == "id_mercaderista_Calc")
                {
                    e.Column.Visible = false;
                    GridBoundColumn boundColumn = e.Column as GridBoundColumn;
                    boundColumn.ReadOnly = true;
                }
            }
            #endregion
            //else if (e.Column.UniqueName == "createby")
            //{
            //    e.Column.OrderIndex = 1;
            //}
            //else if (e.Column.UniqueName == "Colgate Ultra 12 x 14")
            //{
            //    GridBoundColumn colTelephone =
            //     gv_presencia.Columns.FindByUniqueName("Colgate Ultra 12 x 14") as GridBoundColumn;
            //    colTelephone.DataFormatString = "{0:$####.##}";
            //}

            //else if (e.Column.UniqueName == "createby")
            //{

            //    "{0:$####.##}"
            //}
            ////DataFormatString="{0:C}"
        }
Exemplo n.º 15
0
        private void CreateGridColumns()
        {
            if (TableInfo == null)
            {
                return;
            }
            TableInfo ti = TableInfo;
            int       i  = 0;

            uxGrid.MasterTableView.Columns.Clear();
            foreach (ColumnInfo c in ti.Columns)
            {
                if (c.IsPrimaryKey)
                {
                    uxGrid.MasterTableView.DataKeyNames = new string[] { c.ColumnName };
                    if (c.IsIdentity)
                    {
                        continue;
                    }
                }
                GridEditableColumn col;
                var fk = c.ForeignKeyRelation;
                if (fk == null)
                {
                    if (c.DataType == DbType.Boolean)
                    {
                        col = new GridCheckBoxColumn();

                        uxGrid.MasterTableView.Columns.Insert(i, col);
                        ((GridCheckBoxColumn)col).DataField = c.ColumnName;
                    }
                    else
                    {
                        col = new GridBoundColumn();

                        uxGrid.MasterTableView.Columns.Insert(i, col);
                        ((GridBoundColumn)col).DataField = c.ColumnName;
                    }
                    col.DataType = DbTypeUtility.GetType(c.DataType);
                }
                else
                {
                    GridDropDownColumn dc = new GridDropDownColumn();
                    col = dc;
                    if (c.ColumnName.ToLower() != "unionid")
                    {
                        uxGrid.MasterTableView.Columns.Insert(i, col);
                        dc.DataField      = c.ColumnName;
                        dc.DataType       = DbTypeUtility.GetType(c.DataType);
                        dc.DataSourceID   = "gidDS_" + c.ColumnName;
                        dc.ListTextField  = "_col_";
                        dc.ListValueField = fk.PKField;
                    }
                }
                col.HeaderText            = c.Title;
                col.SortExpression        = c.ColumnName;
                col.ShowFilterIcon        = false;
                col.CurrentFilterFunction = GridKnownFunction.Contains;
                col.AutoPostBackOnFilter  = true;
                //col.UniqueName = c.ColumnName;
                i++;
            }
        }
Exemplo n.º 16
0
        private void Page_Load(object sender, System.EventArgs e)
        {
            if (!IsPostBack)
            {

                GridEditCommandColumn GEC = new GridEditCommandColumn();
                this.RadGrid1.MasterTableView.Columns.Add(GEC);
                GEC.UniqueName = "EditCommandColumn";
                GEC.ButtonType = GridButtonColumnType.ImageButton;
                GEC.ItemStyle.Width = 20;
                GEC.OrderIndex = 0;

                GridButtonColumn GBC = new GridButtonColumn();
                this.RadGrid1.MasterTableView.Columns.Add(GBC);
                GBC.CommandName = "Delete";
                GBC.Text = "Delete";
                GBC.ItemStyle.Width = 20;
                GBC.ButtonType = GridButtonColumnType.ImageButton;

                BLL.CustomFilteringColumn gridColumn2 = new BLL.CustomFilteringColumn();
                this.RadGrid1.MasterTableView.Columns.Add(gridColumn2);
                gridColumn2.DataField = "FirstName";
                gridColumn2.HeaderText = "First Name";
                gridColumn2.ItemStyle.CssClass = "UseHand";

                BLL.CustomFilteringColumn gridColumn3 = new BLL.CustomFilteringColumn();
                this.RadGrid1.MasterTableView.Columns.Add(gridColumn3);
                gridColumn3.DataField = "LastName";
                gridColumn3.HeaderText = "Last Name";

                BLL.CustomFilteringColumn gridColumn4 = new BLL.CustomFilteringColumn();
                this.RadGrid1.MasterTableView.Columns.Add(gridColumn4);
                gridColumn4.DataField = "Email";
                gridColumn4.HeaderText = "Email";
                gridColumn4.ItemStyle.Width = 400;

                GridDateTimeColumn gridColumn5 = new GridDateTimeColumn();
                this.RadGrid1.MasterTableView.Columns.Add(gridColumn5);
                gridColumn5.DataField = "Birthday";
                gridColumn5.HeaderText = "Birthday";
                gridColumn5.ItemStyle.Width = 200;
                gridColumn5.AllowFiltering = false;

                GridCheckBoxColumn gridColumn6 = new GridCheckBoxColumn();
                this.RadGrid1.MasterTableView.Columns.Add(gridColumn6);
                gridColumn6.DataField = "IsLockedOut";
                gridColumn6.HeaderText = "Locked Out";
                gridColumn6.AllowFiltering = false;

                //BLL.CustomFilteringColumn gridColumn7 = new BLL.CustomFilteringColumn();
                //this.RadGrid1.MasterTableView.Columns.Add(gridColumn7);
                //gridColumn7.DataField = "Gender";
                //gridColumn7.HeaderText = "Gender";
                //gridColumn7.AllowFiltering = false;

                //RadComboBox gridColumn7 = new RadComboBox();
                //this.RadGrid1.MasterTableView.Columns.Add(gridColumn7);

                //gridColumn7.Items[0].Text = "Male";
                //gridColumn7.Items[0].Value = "Male";

                //gridColumn7.Items[1].Text = "Female";
                //gridColumn7.Items[1].Value = "Female";

            }
        }
Exemplo n.º 17
0
        public static void GenerateColumnsSfDataGrid(SfDataGrid dataGrid, DataTable table, string prefab)
        {
            using (var conn = new SqlConnection(App.ConnectionString))
            {
                conn.Open();
                if (!string.IsNullOrEmpty(prefab))
                {
                    DataTable prefabTable = App.GetPrefabDataTable(conn, $"{Settings.Default.Schema}_PREFABS", prefab);
                    DataTable comboTable  =
                        App.GetPrefabDataTable(conn, $"{Settings.Default.Schema}_COMBOBOXES", prefab);

                    //could loop by table.ColumnNames.Count; but if prebab is changed... problems; maybe not all columns showing
                    for (var i = 0; i < table.Columns.Count; i++)
                    {
                        GridColumn column;

                        try
                        {
                            if (prefabTable.Rows[i]["TYPES"].ToString().ToLower().Equals("autocomplete"))
                            {
                                column = new GridTemplateColumn
                                {
                                    MappingName = table.Columns[i].ColumnName,
                                    HeaderText  = prefabTable.Rows[i]["COLUMNS"].ToString()
                                };

                                var comboStrings = new HashSet <string>();
                                for (var j = 0; j < comboTable.Rows.Count; j++)
                                {
                                    if (!string.IsNullOrEmpty(
                                            comboTable.Rows[j][prefabTable.Rows[i]["COLUMNS"].ToString()].ToString()))
                                    {
                                        comboStrings.Add(comboTable.Rows[j][prefabTable.Rows[i]["COLUMNS"].ToString()]
                                                         .ToString());
                                    }
                                }

                                var autoCompleteElem = new FrameworkElementFactory(typeof(AutoComplete));

                                var autoCompleteItemsBind = new Binding
                                {
                                    Source = comboStrings,
                                    UpdateSourceTrigger   = UpdateSourceTrigger.PropertyChanged,
                                    BindsDirectlyToSource = true
                                };

                                var autoCompleteBind =
                                    new Binding(table.Columns[i].ColumnName)
                                {
                                    UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged,
                                    Mode = BindingMode.TwoWay,
                                    BindsDirectlyToSource = true
                                };

                                autoCompleteElem.SetValue(UIElement.FocusableProperty, true);
                                autoCompleteElem.SetValue(AutoComplete.IsDropDownOpenProperty, true);
                                autoCompleteElem.SetValue(ItemsControl.IsTextSearchEnabledProperty, true);
                                autoCompleteElem.SetValue(AutoComplete.IsAutoAppendProperty, true);
                                autoCompleteElem.SetValue(ItemsControl.IsTextSearchCaseSensitiveProperty, false);
                                autoCompleteElem.SetValue(AutoComplete.CustomSourceProperty, autoCompleteItemsBind);
                                autoCompleteElem.SetValue(AutoComplete.TextProperty, autoCompleteBind);
                                autoCompleteElem.SetValue(AutoComplete.CanResizePopupProperty, false);
                                //autoCompleteElem.SetValue(AutoComplete.IsFilterProperty, true);
                                autoCompleteElem.SetValue(AutoComplete.EnableSortingProperty, false);

                                var cellEditingTemplate =
                                    new DataTemplate(typeof(AutoComplete))
                                {
                                    VisualTree = autoCompleteElem
                                };
                                ((GridTemplateColumn)column).EditTemplate = cellEditingTemplate;

                                var defaultElement = new FrameworkElementFactory(typeof(TextBlock));

                                var bind = new Binding(table.Columns[i].ColumnName)
                                {
                                    UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged,
                                    Mode = BindingMode.TwoWay,
                                    BindsDirectlyToSource = true
                                };

                                defaultElement.SetValue(TextBlock.TextProperty, bind);
                                defaultElement.SetValue(FrameworkElement.VerticalAlignmentProperty,
                                                        VerticalAlignment.Center);

                                var defaultTemplate = new DataTemplate(typeof(TextBlock))
                                {
                                    VisualTree = defaultElement
                                };
                                ((GridTemplateColumn)column).CellTemplate = defaultTemplate;

                                dataGrid.Columns.Add(column);
                            }
                            else if (prefabTable.Rows[i]["TYPES"].ToString().ToLower().Equals("datepicker"))
                            {
                                column = new GridDateTimeColumn
                                {
                                    MappingName            = table.Columns[i].ColumnName,
                                    Pattern                = DateTimePattern.ShortDate,
                                    CanEdit                = true,
                                    AllowNullValue         = true,
                                    NullText               = string.Empty,
                                    AllowScrollingOnCircle = true,
                                    EnableBackspaceKey     = true,
                                    EnableDeleteKey        = true,
                                    ShowRepeatButton       = true,
                                    HeaderText             = prefabTable.Rows[i]["COLUMNS"].ToString()
                                };

                                dataGrid.Columns.Add(column);
                            }
                            else if (prefabTable.Rows[i]["TYPES"].ToString().ToLower().Equals("checkbox"))
                            {
                                column = new GridCheckBoxColumn
                                {
                                    MappingName  = table.Columns[i].ColumnName,
                                    IsThreeState = false,
                                    HeaderText   = prefabTable.Rows[i]["COLUMNS"].ToString()
                                };

                                dataGrid.Columns.Add(column);
                            }
                            else if (prefabTable.Rows[i]["TYPES"].ToString().ToLower().Equals("numeric"))
                            {
                                column = new GridNumericColumn
                                {
                                    MappingName          = table.Columns[i].ColumnName,
                                    HeaderText           = prefabTable.Rows[i]["COLUMNS"].ToString(),
                                    NumberDecimalDigits  = 3,
                                    NumberGroupSeparator = ","
                                };

                                dataGrid.Columns.Add(column);
                            }
                            else if (prefabTable.Rows[i]["TYPES"].ToString().ToLower().Equals("currency"))
                            {
                                column = new GridCurrencyColumn
                                {
                                    MappingName = table.Columns[i].ColumnName,
                                    HeaderText  = prefabTable.Rows[i]["COLUMNS"].ToString()
                                };

                                dataGrid.Columns.Add(column);
                            }
                            else if (prefabTable.Rows[i]["TYPES"].ToString().ToLower().Equals("hyperlink"))
                            {
                                column = new GridHyperlinkColumn
                                {
                                    MappingName = table.Columns[i].ColumnName,
                                    HeaderText  = prefabTable.Rows[i]["COLUMNS"].ToString()
                                };

                                dataGrid.Columns.Add(column);
                            }
                            else if (prefabTable.Rows[i]["TYPES"].ToString().ToLower().Equals("percentage"))
                            {
                                column = new GridPercentColumn
                                {
                                    MappingName = table.Columns[i].ColumnName,
                                    HeaderText  = prefabTable.Rows[i]["COLUMNS"].ToString()
                                };

                                dataGrid.Columns.Add(column);
                            }
                            else if (prefabTable.Rows[i]["TYPES"].ToString().ToLower().Equals("combobox"))
                            {
                                var comboStrings = new HashSet <string>();
                                for (var j = 0; j < comboTable.Rows.Count; j++)
                                {
                                    if (!string.IsNullOrEmpty(
                                            comboTable.Rows[j][prefabTable.Rows[i]["COLUMNS"].ToString()].ToString()))
                                    {
                                        comboStrings.Add(comboTable.Rows[j][prefabTable.Rows[i]["COLUMNS"].ToString()]
                                                         .ToString());
                                    }
                                }

                                column = new GridComboBoxColumn
                                {
                                    MappingName     = table.Columns[i].ColumnName,
                                    ItemsSource     = comboStrings,
                                    StaysOpenOnEdit = true,
                                    IsEditable      = true,
                                    HeaderText      = prefabTable.Rows[i]["COLUMNS"].ToString()
                                };

                                dataGrid.Columns.Add(column);
                            }
                            else
                            {
                                column = new GridTextColumn
                                {
                                    MappingName = table.Columns[i].ColumnName,
                                    HeaderText  = prefabTable.Rows[i]["COLUMNS"].ToString()
                                };

                                dataGrid.Columns.Add(column);
                            }
                        }
                        catch
                        {
                            column = new GridTextColumn
                            {
                                MappingName = table.Columns[i].ColumnName,
                                HeaderText  = table.Columns[i].ColumnName
                            };

                            dataGrid.Columns.Add(column);
                        }
                    }
                }
                else
                {
                    foreach (DataColumn column in table.Columns)
                    {
                        GridColumn gridColumn = new GridTextColumn
                        {
                            MappingName = column.ColumnName,
                            HeaderText  = column.ColumnName
                        };

                        dataGrid.Columns.Add(gridColumn);
                    }
                }

                conn.Close();
            }
        }
Exemplo n.º 18
0
        public override GridColumn CreateColumn()
        {
            GridCheckBoxColumn column = new GridCheckBoxColumn();

            return(column);
        }
Exemplo n.º 19
0
        public static void UtworzKolumny(List <GridViewColumn> kolumny, RadGrid radGrid, bool isPostBack, Page page)
        {
            foreach (var opisKolumny in kolumny)
            {
                GridEditableColumn column = null;
                if (opisKolumny.ColumnType == GridColumnType.CheckboxColumn)
                {
                    var cbColumn = new GridCheckBoxColumn();
                    cbColumn.DataField = opisKolumny.Name;


                    column = cbColumn;
                }
                else if (opisKolumny.ColumnType == GridColumnType.BoundColumn)
                {
                    var bColumn = new GridBoundColumn();
                    bColumn.DataField = opisKolumny.Name;
                    bColumn.Aggregate = (Telerik.Web.UI.GridAggregateFunction)opisKolumny.Aggregate;
                    if (string.IsNullOrEmpty(opisKolumny.DataTypeName) == false)
                    {
                        bColumn.DataType = Type.GetType(opisKolumny.DataTypeName);
                    }
                    if (bColumn.Aggregate == GridAggregateFunction.Count)
                    {
                        bColumn.FooterText = "Ilość: ";
                    }
                    bColumn.DataFormatString = opisKolumny.DataFormatString;

                    column = bColumn;
                }
                else if (opisKolumny.ColumnType == GridColumnType.EnumColumn)
                {
                    var templateColumn = new GridTemplateColumn();
                    templateColumn.DataField = opisKolumny.Name;
                    templateColumn.Aggregate = (Telerik.Web.UI.GridAggregateFunction)opisKolumny.Aggregate;
                    if (string.IsNullOrEmpty(opisKolumny.DataTypeName) == false)
                    {
                        templateColumn.DataType = Type.GetType(opisKolumny.DataTypeName);
                    }
                    var typEnuma = Type.GetType(opisKolumny.DataTypeName);
                    templateColumn.EditItemTemplate = new EnumEditColumnTemplate(opisKolumny.Name, typEnuma);
                    templateColumn.ItemTemplate     = new EnumItemColumnTemplate(opisKolumny.Name);
                    templateColumn.FilterTemplate   = new EnumFilterColumnTemplate(opisKolumny.Name, typEnuma, page);
                    column = templateColumn;
                }


                column.UniqueName = opisKolumny.Name;

                column.HeaderText         = opisKolumny.GetReadableName();
                column.HeaderTooltip      = opisKolumny.ToolTip;
                column.FilterControlWidth = new Unit("80px");
                column.ReadOnly           = opisKolumny.ReadOnly;

                //boundColumn.ColumnEditorID = opisKolumny.ColumnEditorID;
                if (opisKolumny.Width != null)
                {
                    column.HeaderStyle.Width = new Unit(opisKolumny.Width.ToString());
                }
                //if (opisKolumny.NazwaTypuPola == "Decimal")
                //{

                //}
                if (opisKolumny.ShowColumnFilter)
                {
                    column.AutoPostBackOnFilter  = true;
                    column.CurrentFilterFunction = (Telerik.Web.UI.GridKnownFunction)opisKolumny.FilterFunction;
                    column.ShowFilterIcon        = false;

                    if (isPostBack == false)
                    {
                        column.CurrentFilterValue = opisKolumny.FilterDefaultValue;
                        if (string.IsNullOrEmpty(opisKolumny.FilterDefaultValue) == false)
                        {
                            var filtr = "([" + opisKolumny.Name + "] = '" + opisKolumny.FilterDefaultValue + "')";

                            if (string.IsNullOrEmpty(radGrid.MasterTableView.FilterExpression))
                            {
                                radGrid.MasterTableView.FilterExpression = filtr;
                            }
                            else
                            {
                                radGrid.MasterTableView.FilterExpression = radGrid.MasterTableView.FilterExpression +
                                                                           " AND " +
                                                                           filtr;
                            }
                        }
                    }
                }
                else
                {
                    column.AllowFiltering = false;
                }

                radGrid.MasterTableView.Columns.Add(column);
            }
        }