public CarrotWebDataTable AddColumn(string columnName, ICarrotGridColumn column)
        {
            if (column.Mode != CarrotGridColumnType.Template) {
                if (column is ICarrotGridColumnExt) {
                    var col = (ICarrotGridColumnExt)column;
                    col.ColumnName = columnName;
                    if (!this.UseDataPage) {
                        col.Sortable = false;
                    }

                    if (String.IsNullOrEmpty(column.HeaderText) && column.HasHeadingText) {
                        column.HeaderText = col.ColumnName.Replace(".", " ").Replace("_", " ");
                    }
                    if (!column.HasHeadingText && !col.Sortable) {
                        column.HeaderText = "  ";
                    }
                }
            }

            column.Order = this.Columns.Count();

            this.Columns.Add(column);

            return this;
        }
Пример #2
0
        public CarrotWebDataTable AddColumn(string columnName, ICarrotGridColumn column)
        {
            if (column.Mode != CarrotGridColumnType.Template)
            {
                if (column is ICarrotGridColumnExt)
                {
                    var col = (ICarrotGridColumnExt)column;
                    col.ColumnName = columnName;
                    if (!this.UseDataPage)
                    {
                        col.Sortable = false;
                    }

                    if (String.IsNullOrEmpty(column.HeaderText) && column.HasHeadingText)
                    {
                        column.HeaderText = col.ColumnName.Replace(".", " ").Replace("_", " ");
                    }
                    if (!column.HasHeadingText && !col.Sortable)
                    {
                        column.HeaderText = "  ";
                    }
                }
            }

            column.Order = this.Columns.Count();

            this.Columns.Add(column);

            return(this);
        }
Пример #3
0
        public CarrotWebGrid <T> AddColumn(Expression <Func <T, Object> > property, ICarrotGridColumn column)
        {
            MemberExpression memberExpression = property.Body as MemberExpression ??
                                                ((UnaryExpression)property.Body).Operand as MemberExpression;

            if (column.Mode != CarrotGridColumnType.Template)
            {
                //string columnName = memberExpression.Member.Name;
                string columnName = ReflectionUtilities.BuildProp(property);

                if (column is ICarrotGridColumnExt)
                {
                    var col = (ICarrotGridColumnExt)column;
                    col.ColumnName = columnName;
                    if (!this.UseDataPage)
                    {
                        col.Sortable = false;
                    }

                    if (String.IsNullOrEmpty(column.HeaderText) && column.HasHeadingText)
                    {
                        column.HeaderText = col.ColumnName.Replace(".", " ").Replace("_", " ");

                        string displayName = CarrotWeb.DisplayNameFor <T>(property);
                        if (!String.IsNullOrEmpty(displayName))
                        {
                            column.HeaderText = displayName;
                        }
                    }
                    if (!column.HasHeadingText && !col.Sortable)
                    {
                        column.HeaderText = "  ";
                    }
                }
            }

            column.Order = this.Columns.Count();

            this.Columns.Add(column);

            return(this);
        }