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

GridBoundColumnBuilder

Properties

Column - IGridBoundColumn

Methods

Format(System.String)

Gets or sets the format for displaying the data.

Parameters

value - System.String

The value.

Example


                @(Html.Kendo().Grid(Model)
                        .Name("Grid")
                        .Columns(columns => columns.Bound(o => o.OrderDate).Format("{0:dd/MM/yyyy}")))

EditorViewData(System.Object)

Provides additional view data in the editor template for that column (if any).

Parameters

additionalViewData - System.Object

An anonymous object which contains the additional data

Example


                @(Html.Kendo().Grid(Model)
                        .Name("Grid")
                        .Columns(columns => {
                            columns.Bound(o => o.Customer).EditorViewData(new { customers = Model.Customers });
                        }))

EditorTemplateName(System.String)

Specify which editor template should be used for the column

Parameters

templateName - System.String

name of the editor template

Example


                @(Html.Kendo().Grid(Model)
                    .Columns(c=>c.Bound(x=>x.Company).EditorTemplateName("EditorName")))

EditorTemplateComponentName(System.String)

Parameters

templateName - System.String

Sortable(System.Boolean)

Enables or disables sorting the column. All bound columns are sortable by default.

Parameters

value - System.Boolean

Example


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

Sortable(System.Action)

Configures the sorting functionality of the column.

Parameters

configurator - System.Action<GridBoundColumnSortableBuilder>

Example


                 @(Html.Kendo().Grid(Model)
                         .Name("Grid")
                         .Columns(columns => columns.Bound(x => x.Name).Sortable(s => s.AllowUnsort(true))))


Groupable(System.Boolean)

Enables or disables grouping by that column. All bound columns are groupable by default.

Parameters

value - System.Boolean

Example


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

Groupable(System.Action)

Sets the sort configuration when grouping.

Parameters

configurator - System.Action<GridBoundColumnGroupableBuilder>

Example


                @(Html.Kendo().Grid(Model)
                        .Name("Grid")
                        .Columns(columns => columns.Bound(o => o.OrderDate).Groupable(x => x.Sort(sort => sort.Dir(ListSortDirection.Ascending)))))

Filterable(System.Boolean)

Enables or disables filtering the column. All bound columns are filterable by default.

Parameters

value - System.Boolean

Example


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

Filterable(System.Action)

Enables or disables filtering the column. Through the configurator you can configure the filter functionality.

Parameters

configurator - System.Action<GridBoundColumnFilterableBuilder>

Example


                @(Html.Kendo().Grid(Model)
                    .Name("Grid")
                    .Columns(columns=>
                    {
                        columns.Bound(x => x.Name).Filterable(f => f.Enabled(true));
                    }))

Encoded(System.Boolean)

Enables or disables HTML encoding the data of the column. All bound columns are encoded by default.

Parameters

value - System.Boolean

Example


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

Template(System.Action)

Sets the template for the column.

Parameters

templateAction - System.Action<T>

The action defining the template.

Example


                @(Html.Kendo().Grid<User>()
                    .Name("grid")
                    .Columns(columns =>
                    {
                        columns.Bound(c => c.Name).Template(@<text>
                                        <strong>My Template</strong>
                                                            </text>);
                    }))

Template(System.Func)

Sets the template for the column.

Parameters

inlineTemplate - System.Func<T,Object>

The action defining the template.

Example


            @(Html.Kendo().Grid<User>()
                .Name("grid")
                .Columns(columns =>
               {
                   columns.Bound(c => c.Name).Template(x=>x.Name.ToUpper());
               }))

ClientTemplate(System.String)

Sets the client template for the column.

Parameters

value - System.String

The template

Example


            @(Html.Kendo().Grid<User>()
                   .Name("grid")
                   .Columns(columns =>
                   {
                       columns.Bound(c => c.Name).ClientTemplate("Template value");
                   }))

ClientTemplate(Kendo.Mvc.UI.TemplateBuilder)

Parameters

templateBuilder - TemplateBuilder<TModel>

ClientTemplateHandler(System.String)

Parameters

handler - System.String

ClientGroupHeaderTemplate(System.String)

Sets the client group template for the column.

Parameters

value - System.String

The template

Example


            @(Html.Kendo().Grid<User>()
                   .Name("grid")
                   .Columns(columns =>
                   {
                       columns.Bound(c => c.Name).ClientGroupHeaderTemplate("Template value");
                   }))

ClientGroupHeaderTemplateHandler(System.String)

Parameters

value - System.String

ClientGroupHeaderTemplate(Kendo.Mvc.UI.TemplateBuilder)

Parameters

templateBuilder - TemplateBuilder<TModel>

GroupHeaderColumnTemplate(System.Action)

Sets the group header column template for the column.

Parameters

template - System.Action<GridAggregateResult>

The action defining the template.

Example


            @(Html.Kendo().Grid<User>()
                   .Name("grid")
                   .Columns(columns =>
                   {
                       columns.Bound(c => c.Name).GroupHeaderColumnTemplate(@<text> Template </text>);
                   }))

GroupHeaderColumnTemplate(System.Func)

Sets the group header column template for the column.

Parameters

template - System.Func<GridAggregateResult,Object>

The action defining the template.

Example


            @(Html.Kendo().Grid<User>()
                   .Name("grid")
                   .Columns(columns =>
                   {
                       columns.Bound(c => c.Name).GroupHeaderColumnTemplate(x=>x.Count);
                   }))

ClientGroupHeaderColumnTemplate(System.String)

Sets the client group header column template for the column.

Parameters

value - System.String

The template

Example


            @(Html.Kendo().Grid<User>()
                   .Name("grid")
                   .Columns(columns =>
                   {
                       columns.Bound(c => c.Name).ClientGroupHeaderColumnTemplate("Template value");
                   }))

FooterTemplate(System.Action)

Sets the footer template for the column.

Parameters

template - System.Action<GridAggregateResult>

The action defining the template.

Example


            @(Html.Kendo().Grid<User>()
                   .Name("grid")
                   .Columns(columns =>
                   {
                       columns.Bound(c => c.Name).FooterTemplate(x=>x.Average);
                   }))

FooterTemplate(System.Func)

Sets the footer template for the column.

Parameters

template - System.Func<GridAggregateResult,Object>

The action defining the template.

Example


            @(Html.Kendo().Grid<User>()
                   .Name("grid")
                   .Columns(columns =>
                   {
                       columns.Bound(c => c.Name).FooterTemplate(@<text>Template</text>);
                   }))

GroupFooterTemplate(System.Action)

Sets the group footer template for the column.

Parameters

template - System.Action<GridAggregateResult>

The action defining the template.

GroupFooterTemplate(System.Func)

Sets the group footer template for the column.

Parameters

template - System.Func<GridAggregateResult,Object>

The action defining the template.

Example


            @(Html.Kendo().Grid<User>()
                   .Name("grid")
                   .Columns(columns =>
                   {
                       columns.Bound(c => c.Name).GroupFooterTemplate(x=>x.Average);
                   }))

GroupHeaderTemplate(System.Action)

Sets the group footer template for the column.

Parameters

template - System.Action<GridGroupAggregateResult>

The action defining the template.

GroupHeaderTemplate(System.Func)

Sets the group footer template for the column.

Parameters

template - System.Func<GridGroupAggregateResult,Object>

The action defining the template.

Example


            @(Html.Kendo().Grid<User>()
                   .Name("grid")
                   .Columns(columns =>
                   {
                       columns.Bound(c => c.Name).GroupHeaderTemplate(x=>x.Count);
                   }))

Editable(System.Func)

Sets the editable function.

Parameters

handler - System.Func<Object,Object>

The editable function in a text tag.

Example


               @(Html.Kendo().Grid<User>()
                           .Name("grid")
                           .Columns(columns =>
                           {
                               columns.Bound(c => c.Name).Editable(x=>"isEditable");
                           }))

Editable(System.String)

Sets the editable function.

Parameters

handler - System.String

The name of the JavaScript function that will determine if the cell will be editable.

Example


               @(Html.Kendo().Grid<User>()
                           .Name("grid")
                           .Columns(columns =>
                           {
                               columns.Bound(c => c.Name).Editable("isEditable");
                           }))

HideOnGroup(System.Boolean)

If set to true the column will be hidden when the grid is groupd via user interaction. The column will be displayed again if interaction to ungroup by it is performed.

Parameters

value - System.Boolean

Example


               @(Html.Kendo().Grid<User>()
                           .Name("grid")
                           .Columns(columns =>
                           {
                               columns.Bound(c => c.Name).HideOnGroup(true);
                           }))

AddServerAttribute(System.String,System.Func)

This configuration options should be used with Server Binding. When Server Bininding is enabled, adds a HTML attribute based on a condition, evaluated on the server.

Parameters

key - System.String
condition - System.Func<T,Object>

Example


               @(Html.Kendo().Grid<User>()
                           .Name("grid")
                           .Columns(columns =>
                           {
                               columns.Bound(c => c.Name).AddServerAttribute("class", (p) => p.Discontinued == true ? "myClass" : "myOtherClass");
                           }))

FooterHtmlAttributes(System.Object)

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

Parameters

attributes - System.Object

The attributes.

Example


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

FooterHtmlAttributes(System.Collections.Generic.IDictionary)

Sets the HTML attributes applied to the footer 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).FooterHtmlAttributes(new {@class="order-footer"})))

IncludeInMenu(System.Boolean)

Specifys whether the columns should be included in column header menu. By default all columns are included. The column also need to have a Title set in order to be included in the menu.

Parameters

value - System.Boolean

The value used for the condition.

Example


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

FooterTemplate(System.Action)

Sets the footer template for the column.

Parameters

template - System.Action

The action defining the template.

Example


               @(Html.Kendo().Grid(Model)
                          .Name("Grid")
                             .Columns(columns => columns.Bound(o => o.Name).FooterTemplate(x=>x.Average)))

FooterTemplate(System.String)

Sets the footer template for the column.

Parameters

template - System.String

The string defining the template.

Example


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

FooterTemplate(System.Func)

Sets the footer template for the column.

Parameters

template - System.Func<Object,Object>

The action defining the template.

Example


                    @(Html.Kendo().Grid(Model)
                            .Name("Grid")
                               .Columns(columns => columns.Bound(o => o.Name).FooterTemplate(@<text> Template </text>)))

ClientFooterTemplate(System.String)

Sets the client footer template for the column.

Parameters

template - System.String

The action defining the template.

Example


                    @(Html.Kendo().Grid(Model)
                            .Name("Grid")
                               .Columns(columns => columns.Bound(o => o.Name).ClientFooterTemplate("Template value")))

ClientFooterTemplate(Kendo.Mvc.UI.TemplateBuilder)

Parameters

templateBuilder - TemplateBuilder<TModel>

ClientFooterTemplateHandler(System.String)

Parameters

handler - System.String

ClientGroupFooterTemplate(System.String)

Sets the client group footer template for the column.

Parameters

template - System.String

The template

Example


                    @(Html.Kendo().Grid(Model)
                            .Name("Grid")
                               .Columns(columns => columns.Bound(o => o.Name).ClientGroupFooterTemplate("Template value")))

ClientGroupFooterTemplate(Kendo.Mvc.UI.TemplateBuilder)

Parameters

templateBuilder - TemplateBuilder<TModel>

ClientGroupFooterTemplateHandler(System.String)

Parameters

handler - System.String

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"})))

HtmlAttributes(System.String)

Sets name of the handler that sets the html attributes

Parameters

attributesHandler - System.String

The attributes handler name.

Example


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

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"])))

HeaderTemplate(System.Action)

Sets the header template for the column. If sorting is enabled, the template content wrapper must have a k-link CSS class.

Parameters

template - System.Action

The action defining the template.

HeaderTemplate(System.String)

Sets the header template for the column. If sorting is enabled, the template content wrapper must have a k-link CSS class.

Parameters

template - System.String

The string defining the template.

Example


               @(Html.Kendo().Grid(Model)
                   .Name("grid")
                   .Columns(columns =>
                   {
                       columns.Bound(c => c.Name).HeaderTemplate("Template value");
                   }))

HeaderTemplate(System.Func)

Sets the header template for the column. If sorting is enabled, the template content wrapper must have a k-link CSS class.

Parameters

template - System.Func<Object,Object>

The action defining the template.

Example


               @(Html.Kendo().Grid(Model)
                   .Name("grid")
                   .Columns(columns =>
                   {
                       columns.Bound(c => c.Name).HeaderTemplate(@<text>Template</text>);
                   }))

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))))

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)))

In this article
Not finding the help you need?