New to Telerik UI for ASP.NET Core? Download free 30-day trial

GridColumnBuilderBase

Defines the fluent interface for configuring columns.

Properties

Column - TColumn

Methods

Title(System.String)

Sets the title displayed in the header of the column. Any HTML entities or tags should be encoded, or use a HeaderTemplate instead.

Parameters

text - System.String

The text.

Example


                    @(Html.Kendo().Grid(Model)
                        .Name("Grid")
                        .Columns(columns => columns.Bound(o => o.OrderID).Title("ID")))

HeaderHtmlAttributes(System.Object)

Sets the HTML attributes applied to the header cell of the column.

Parameters

attributes - System.Object

The attributes.

Example


                    @(Html.Kendo().Grid(Model)
                        .Name("Grid")
                        .Columns(columns => columns.Bound(o => o.OrderID).HeaderHtmlAttributes(new {@class="order-header"})))

HeaderHtmlAttributes(System.Collections.Generic.IDictionary)

Sets the HTML attributes applied to the header cell of the column.

Parameters

attributes - System.Collections.Generic.IDictionary<String,Object>

The attributes.

Example


                    @(Html.Kendo().Grid(Model)
                        .Name("Grid")
                        .Columns(columns => columns.Bound(o => o.OrderID).HeaderHtmlAttributes(new {@class="order-header"})))

HtmlAttributes(System.Object)

Sets the HTML attributes applied to the content cell of the column.

Parameters

attributes - System.Object

The attributes.

Example


                @(Html.Kendo().Grid(Model)
                        .Name("Grid")
                        .Columns(columns => columns.Bound(o => o.OrderID).HtmlAttributes(new {@class="order-cell"})))

HtmlAttributes(System.Collections.Generic.IDictionary)

Sets the HTML attributes applied to the content cell of the column.

Parameters

attributes - System.Collections.Generic.IDictionary<String,Object>

The attributes.

Example


                @(Html.Kendo().Grid(Model)
                        .Name("Grid")
                        .Columns(columns => columns.Bound(o => o.OrderID).HtmlAttributes(new {@class="order-cell"})))

Media(System.String)

Sets the media query condition that needs to be satisfied for a column to remain visible.

Parameters

value - System.String

The text.

Example


                    @(Html.Kendo().Grid(Model)
                        .Name("Grid")
                        .Columns(columns => columns.Bound(o => o.OrderID).Media("(min-width: 600px)")))

MinScreenWidth(System.Int32)

Sets the minimum screen width in pixels at which the column will become hidden.

Parameters

value - System.Int32

Example


                @(Html.Kendo().Grid(Model)
                    .Name("Grid")
                    .Columns(columns => columns.Bound(o => o.OrderID).MinScreenWidth(450))
                 )

MinResizableWidth(System.Int32)

The pixel screen width below which the user will not be able to resize the column via the UI.

Parameters

value - System.Int32

Example


            @(Html.Kendo().Grid(Model)
                .Name("Grid")
                .Columns(columns => columns.Bound(o => o.OrderID).MinResizableWidth(450))
            )

Width(System.Int32)

Sets the width of the column in pixels.

Parameters

pixelWidth - System.Int32

The width in pixels.

Example


                @(Html.Kendo().Grid(Model)
                        .Name("Grid")
                        .Columns(columns => columns.Bound(o => o.OrderID).Width(100)))

Width(System.String)

Sets the width of the column using CSS syntax.

Parameters

value - System.String

The width to set.

Example


                @(Html.Kendo().Grid(Model)
                    .Name("grid")
                    .Columns(columns =>
                    {
                        columns.Bound(c => c.Name).Width("200px");
                    }))

Visible(System.Boolean)

Makes the column visible or not. By default all columns are visible. Invisible columns are not rendered in the output HTML.

Parameters

value - System.Boolean

If true the column is visible, otherwise not.

Example


                    @(Html.Kendo().Grid(Model)
                        .Name("Grid")
                        .Columns(columns => columns.Bound(o => o.OrderID).Visible((bool)ViewData["visible"])))

Draggable(System.Boolean)

Makes the column draggable or not. By default the columns are not draggable.

Parameters

value - System.Boolean

If true the column is draggable, otherwise not.

Example


                  @(Html.Kendo().Grid(Model)
                        .Name("Grid")
                        .Columns(columns => columns.Bound(o => o.OrderID).Draggable((bool)ViewData["draggable"])))

Locked()

Makes the column static. By default all columns are not locked.

Example


                 @(Html.Kendo().Grid(Model)
                        .Name("Grid")
                        .Columns(columns => columns.Bound(o => o.OrderID).Locked()))

Locked(System.Boolean)

Makes the column static or not. By default all columns are not locked.

Parameters

value - System.Boolean

If true the column is locked, otherwise not.

Example


                @(Html.Kendo().Grid(Model)
                        .Name("Grid")
                        .Columns(columns => columns.Bound(o => o.OrderID).Locked((bool)ViewData["locked"])))

Lockable(System.Boolean)

If set to false the column will remain in the side of the grid into which its own locked configuration placed it.

Parameters

value - System.Boolean

If true the column is lockable, otherwise not.

Example


                    @(Html.Kendo().Grid(Model)
                        .Name("Grid")
                        .Columns(columns => columns.Bound(o => o.OrderID).Lockable((bool)ViewData["lockable"])))

Sticky()

Makes the column sticky. By default all columns are not sticky.

Example


                 @(Html.Kendo().Grid(Model)
                        .Name("Grid")
                        .Columns(columns => columns.Bound(o => o.OrderID).Sticky()))

Sticky(System.Boolean)

Makes the column sticky or not. By default all columns are not sticky.

Parameters

value - System.Boolean

If true the column is sticky, otherwise not.

Example


                    @(Html.Kendo().Grid(Model)
                        .Name("Grid")
                        .Columns(columns => columns.Bound(o => o.OrderID).Sticky((bool)ViewData["sticky"])))

Stickable()

Makes the column stickable. By default all columns are not stickable.

Example


                    @(Html.Kendo().Grid(Model)
                        .Name("Grid")
                        .Columns(columns => columns.Bound(o => o.OrderID).Stickable()))

Stickable(System.Boolean)

Makes the column stickable or not. By default all columns are not stickable.

Parameters

value - System.Boolean

If true the column is stickable, otherwise not.

Example


                   @(Html.Kendo().Grid(Model)
                        .Name("Grid")
                        .Columns(columns => columns.Bound(o => o.OrderID).Stickable((bool)ViewData["stickable"])))

Hidden(System.Boolean)

Makes the column hidden or not. By default all columns are not hidden. Hidden columns are rendered in the output HTML but are hidden.

Parameters

value - System.Boolean

If true the column is hidden, otherwise not.

Example


                    @(Html.Kendo().Grid(Model)
                        .Name("Grid")
                        .Columns(columns => columns.Bound(o => o.OrderID).Hidden((bool)ViewData["hidden"])))

Hidden()

Makes the column hidden or not. By default all columns are not hidden. Hidden columns are rendered in the output HTML but are hidden.

Example


                    @(Html.Kendo().Grid(Model)
                        .Name("Grid")
                        .Columns(columns => columns.Bound(o => o.OrderID).Hidden((bool)ViewData["hidden"])))

ColumnMenu(System.Boolean)

If set to false the column menu will not be rendered for the specific column.

Parameters

value - System.Boolean

If true the column menu will be rendered, otherwise not.

Example


                    @(Html.Kendo().Grid(Model)
                        .Name("Grid")
                        .Columns(columns => columns.Bound(o => o.OrderID).ColumnMenu(false)))

Exportable(System.Boolean)

If set to false the column will be excluded from the exported Excel/PDF files.

Parameters

value - System.Boolean

If true the column is exportable, otherwise not.

Example


                    @(Html.Kendo().Grid(Model)
                        .Name("Grid")
                        .Columns(columns => columns.Bound(o => o.OrderID).Exportable(false)))

Exportable(System.Action)

The configurator is used to configure the exportable setting of the column.

Parameters

configurator - System.Action<GridColumnExportableBuilder>

The configurator.

Example


                    @(Html.Kendo().Grid(Model)
                        .Name("Grid")
                        .Columns(columns => columns.Bound(o => o.OrderID).Exportable(x=>x.Excel(true).Pdf(false))))

In this article
Not finding the help you need?