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

Defines the fluent interface for configuring bound columns

Definition

Namespace:Kendo.Mvc.UI.Fluent

Assembly:Kendo.Mvc.dll

Type Parameters:

T

The type of the data item

Syntax:

C#
public class GridBoundColumnBuilder<T> : GridColumnBuilder<IGridBoundColumn, GridBoundColumnBuilder<T>> where T : class

Inheritance: objectGridColumnBuilderBase<IGridBoundColumn, GridBoundColumnBuilder<T>>GridColumnBuilder<IGridBoundColumn, GridBoundColumnBuilder<T>>GridBoundColumnBuilder<T>

Inherited Members GridColumnBuilder<IGridBoundColumn, GridBoundColumnBuilder<T>>.FooterHtmlAttributes(object)GridColumnBuilder<IGridBoundColumn, GridBoundColumnBuilder<T>>.FooterHtmlAttributes(object, bool)GridColumnBuilder<IGridBoundColumn, GridBoundColumnBuilder<T>>.FooterHtmlAttributes(IDictionary<string, object>, bool)GridColumnBuilder<IGridBoundColumn, GridBoundColumnBuilder<T>>.FooterHtmlAttributes(IDictionary<string, object>)GridColumnBuilder<IGridBoundColumn, GridBoundColumnBuilder<T>>.IncludeInMenu(bool)GridColumnBuilder<IGridBoundColumn, GridBoundColumnBuilder<T>>.FooterTemplate(Action)GridColumnBuilder<IGridBoundColumn, GridBoundColumnBuilder<T>>.FooterTemplate(string)GridColumnBuilder<IGridBoundColumn, GridBoundColumnBuilder<T>>.FooterTemplate(Func<object, object>)GridColumnBuilder<IGridBoundColumn, GridBoundColumnBuilder<T>>.ClientFooterTemplate(string)GridColumnBuilder<IGridBoundColumn, GridBoundColumnBuilder<T>>.ClientFooterTemplate<TModel>(TemplateBuilder<TModel>)GridColumnBuilder<IGridBoundColumn, GridBoundColumnBuilder<T>>.ClientFooterTemplateHandler(string)GridColumnBuilder<IGridBoundColumn, GridBoundColumnBuilder<T>>.ClientGroupFooterTemplate(string)GridColumnBuilder<IGridBoundColumn, GridBoundColumnBuilder<T>>.ClientGroupFooterTemplateView(MvcHtmlString)GridColumnBuilder<IGridBoundColumn, GridBoundColumnBuilder<T>>.ClientGroupFooterTemplate<TModel>(TemplateBuilder<TModel>)GridColumnBuilder<IGridBoundColumn, GridBoundColumnBuilder<T>>.ClientGroupFooterTemplateHandler(string)GridColumnBuilderBase<IGridBoundColumn, GridBoundColumnBuilder<T>>.Title(string)GridColumnBuilderBase<IGridBoundColumn, GridBoundColumnBuilder<T>>.HeaderHtmlAttributes(object, bool)GridColumnBuilderBase<IGridBoundColumn, GridBoundColumnBuilder<T>>.HeaderHtmlAttributes(IDictionary<string, object>, bool)GridColumnBuilderBase<IGridBoundColumn, GridBoundColumnBuilder<T>>.HtmlAttributes(object, bool)GridColumnBuilderBase<IGridBoundColumn, GridBoundColumnBuilder<T>>.HtmlAttributes(IDictionary<string, object>, bool)GridColumnBuilderBase<IGridBoundColumn, GridBoundColumnBuilder<T>>.HtmlAttributes(string)GridColumnBuilderBase<IGridBoundColumn, GridBoundColumnBuilder<T>>.Media(string)GridColumnBuilderBase<IGridBoundColumn, GridBoundColumnBuilder<T>>.MinScreenWidth(int)GridColumnBuilderBase<IGridBoundColumn, GridBoundColumnBuilder<T>>.MinResizableWidth(int)GridColumnBuilderBase<IGridBoundColumn, GridBoundColumnBuilder<T>>.Width(int)GridColumnBuilderBase<IGridBoundColumn, GridBoundColumnBuilder<T>>.Width(string)GridColumnBuilderBase<IGridBoundColumn, GridBoundColumnBuilder<T>>.Visible(bool)GridColumnBuilderBase<IGridBoundColumn, GridBoundColumnBuilder<T>>.Draggable(bool)GridColumnBuilderBase<IGridBoundColumn, GridBoundColumnBuilder<T>>.Locked()GridColumnBuilderBase<IGridBoundColumn, GridBoundColumnBuilder<T>>.Locked(bool)GridColumnBuilderBase<IGridBoundColumn, GridBoundColumnBuilder<T>>.Lockable(bool)GridColumnBuilderBase<IGridBoundColumn, GridBoundColumnBuilder<T>>.Sticky()GridColumnBuilderBase<IGridBoundColumn, GridBoundColumnBuilder<T>>.Sticky(bool)GridColumnBuilderBase<IGridBoundColumn, GridBoundColumnBuilder<T>>.Stickable()GridColumnBuilderBase<IGridBoundColumn, GridBoundColumnBuilder<T>>.Stickable(bool)GridColumnBuilderBase<IGridBoundColumn, GridBoundColumnBuilder<T>>.Hidden(bool)GridColumnBuilderBase<IGridBoundColumn, GridBoundColumnBuilder<T>>.Hidden()GridColumnBuilderBase<IGridBoundColumn, GridBoundColumnBuilder<T>>.HeaderTemplate(Action)GridColumnBuilderBase<IGridBoundColumn, GridBoundColumnBuilder<T>>.HeaderTemplate(string)GridColumnBuilderBase<IGridBoundColumn, GridBoundColumnBuilder<T>>.HeaderTemplate(Func<object, object>)GridColumnBuilderBase<IGridBoundColumn, GridBoundColumnBuilder<T>>.Exportable(bool)GridColumnBuilderBase<IGridBoundColumn, GridBoundColumnBuilder<T>>.Exportable(Action<GridColumnExportableBuilder>)GridColumnBuilderBase<IGridBoundColumn, GridBoundColumnBuilder<T>>.ColumnMenu(bool)GridColumnBuilderBase<IGridBoundColumn, GridBoundColumnBuilder<T>>.Resizable(bool)GridColumnBuilderBase<IGridBoundColumn, GridBoundColumnBuilder<T>>.Columnobject.GetType()object.MemberwiseClone()object.ToString()object.Equals(object)object.Equals(object, object)object.ReferenceEquals(object, object)object.GetHashCode()...

Constructors

Initializes a new instance of the GridBoundColumnBuilder<T> class.

C#
public GridBoundColumnBuilder(IGridBoundColumn column, ViewContext viewContext, IUrlGenerator urlGenerator)
Parameters:columnIGridBoundColumn

The column.

viewContextViewContext

The ViewContext object

urlGeneratorIUrlGenerator

The IUrlGenerator generator.

Methods

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.

C#
public GridBoundColumnBuilder<T> AddServerAttribute(string key, Func<T, object> condition)
Parameters:keystringconditionFunc<T, object>Returns:

GridBoundColumnBuilder<T>

Example:
C#
@(Html.Kendo().Grid&lt;User&gt;()
.Name("grid")
.Columns(columns =&gt;
{
columns.Bound(c =&gt; c.Name).AddServerAttribute("class", (p) =&gt; p.Discontinued == true ? "myClass" : "myOtherClass");
}))

The aggregate(s) which are calculated when the grid is grouped by the columns field. The supported aggregates are "average", "count", "max", "min" and "sum". Use this setting to set the column aggregates when using an external DataSource.

C#
public GridBoundColumnBuilder<T> Aggregates(string[] aggregates)
Parameters:aggregatesstring[]Returns:

GridBoundColumnBuilder<T>

Example:
C#
@(Html.Kendo().Grid&lt;User&gt;()
.Name("grid")
.Columns(columns =&gt;
{
columns.Bound(c =&gt; c.Name).Aggregates(new string[]{"count"});
}))

Sets the client group header column template for the column.

C#
public GridBoundColumnBuilder<T> ClientGroupHeaderColumnTemplate(string value)
Parameters:valuestring

The template

Returns:

GridBoundColumnBuilder<T>

Example:
C#
@(Html.Kendo().Grid&lt;User&gt;()
.Name("grid")
.Columns(columns =&gt;
{
columns.Bound(c =&gt; c.Name).ClientGroupHeaderColumnTemplate("Template value");
}))

Sets the client group header template for the column.

C#
public GridBoundColumnBuilder<T> ClientGroupHeaderTemplate(string value)
Parameters:valuestring

The template

Returns:

GridBoundColumnBuilder<T>

Example:
C#
@(Html.Kendo().Grid&lt;User&gt;()
.Name("grid")
.Columns(columns =&gt;
{
columns.Bound(c =&gt; c.Name).ClientGroupHeaderTemplate("Template value");
}))

Sets the client group header template for the column using a template builder.

C#
public GridBoundColumnBuilder<T> ClientGroupHeaderTemplate<TModel>(TemplateBuilder<TModel> templateBuilder)
Parameters:templateBuilderTemplateBuilder<TModel>

The template builder that defines the client group header template.

Returns:

GridBoundColumnBuilder<T>

Sets the name of the JavaScript function that will be used as the client group header template handler for the column.

C#
public GridBoundColumnBuilder<T> ClientGroupHeaderTemplateHandler(string value)
Parameters:valuestring

The name of the JavaScript function that will handle the client group header template.

Returns:

GridBoundColumnBuilder<T>

Sets the client group header template for the column.

C#
public GridBoundColumnBuilder<T> ClientGroupHeaderTemplateView(MvcHtmlString value)
Parameters:valueMvcHtmlString

The partial view that will be loaded as a template.

Returns:

GridBoundColumnBuilder<T>

Example:
C#
@(Html.Kendo().Grid&lt;User&gt;()
.Name("grid")
.Columns(columns =&gt;
{
columns.Bound(c =&gt; c.Name).ClientGroupHeaderTemplateView(Html.Partial("_NamePartial"));
}))

Sets the client template for the column.

C#
public GridBoundColumnBuilder<T> ClientTemplate(string value)
Parameters:valuestring

The template

Returns:

GridBoundColumnBuilder<T>

Example:
C#
@(Html.Kendo().Grid&lt;User&gt;()
.Name("grid")
.Columns(columns =&gt;
{
columns.Bound(c =&gt; c.Name).ClientTemplate("Template value");
}))

Sets the client template for the column using a template builder.

C#
public GridBoundColumnBuilder<T> ClientTemplate<TModel>(TemplateBuilder<TModel> templateBuilder)
Parameters:templateBuilderTemplateBuilder<TModel>

The template builder that defines the client template.

Returns:

GridBoundColumnBuilder<T>

Sets the name of the JavaScript function that will be used as the client template handler for the column.

C#
public GridBoundColumnBuilder<T> ClientTemplateHandler(string handler)
Parameters:handlerstring

The name of the JavaScript function that will handle the client template.

Returns:

GridBoundColumnBuilder<T>

Sets the client template for the column.

C#
public GridBoundColumnBuilder<T> ClientTemplateView(MvcHtmlString value)
Parameters:valueMvcHtmlString

The partial view that will be loaded within the template.

Returns:

GridBoundColumnBuilder<T>

Example:
C#
@(Html.Kendo().Grid&lt;User&gt;()
.Name("grid")
.Columns(columns =&gt;
{
columns.Bound(c =&gt; c.Name).ClientTemplateView(Html.Partial("_NamePartial"));
}))

Sets the editable function.

C#
public GridBoundColumnBuilder<T> Editable(Func<object, object> handler)
Parameters:handlerFunc<object, object>

The editable function in a text tag.

Returns:

GridBoundColumnBuilder<T>

Example:
C#
@(Html.Kendo().Grid&lt;User&gt;()
.Name("grid")
.Columns(columns =&gt;
{
columns.Bound(c =&gt; c.Name).Editable(x=&gt;"isEditable");
}))

Sets the editable function.

C#
public GridBoundColumnBuilder<T> Editable(string handler)
Parameters:handlerstring

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

Returns:

GridBoundColumnBuilder<T>

Example:
C#
@(Html.Kendo().Grid&lt;User&gt;()
.Name("grid")
.Columns(columns =&gt;
{
columns.Bound(c =&gt; c.Name).Editable("isEditable");
}))

Specifies the name of the editor template component to be used for the column.

C#
public GridBoundColumnBuilder<T> EditorTemplateComponentName(string templateName)
Parameters:templateNamestring

The name of the editor template component.

Returns:

GridBoundColumnBuilder<T>

Specify which editor template should be used for the column

C#
public GridBoundColumnBuilder<T> EditorTemplateName(string templateName)
Parameters:templateNamestring

name of the editor template

Returns:

GridBoundColumnBuilder<T>

Example:
C#
@(Html.Kendo().Grid(Model)
.Columns(c=&gt;c.Bound(x=&gt;x.Company).EditorTemplateName("EditorName")))

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

C#
public GridBoundColumnBuilder<T> EditorViewData(object additionalViewData)
Parameters:additionalViewDataobject

An anonymous object which contains the additional data

Returns:

GridBoundColumnBuilder<T>

The additional view data will be provided if the editing mode is set to in-line or in-cell. Otherwise use AdditionalViewData(object)

Example:
C#
@(Html.Kendo().Grid(Model)
.Name("Grid")
.Columns(columns =&gt; {
columns.Bound(o =&gt; o.Customer).EditorViewData(new { customers = Model.Customers });
}))

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

C#
public GridBoundColumnBuilder<T> Encoded(bool value)
Parameters:valueboolReturns:

GridBoundColumnBuilder<T>

Example:
C#
@(Html.Kendo().Grid(Model)
.Name("Grid")
.Columns(columns =&gt; columns.Bound(o =&gt; o.OrderDate).Encoded(false)))

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

C#
public GridBoundColumnBuilder<T> Filterable(Action<GridBoundColumnFilterableBuilder> configurator)
Parameters:configuratorAction<GridBoundColumnFilterableBuilder>Returns:

GridBoundColumnBuilder<T>

Example:
C#
@(Html.Kendo().Grid(Model)
.Name("Grid")
.Columns(columns=&gt;
{
columns.Bound(x =&gt; x.Name).Filterable(f =&gt; f.Enabled(true));
}))

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

C#
public GridBoundColumnBuilder<T> Filterable(bool value)
Parameters:valueboolReturns:

GridBoundColumnBuilder<T>

Example:
C#
@(Html.Kendo().Grid(Model)
.Name("Grid")
.Columns(columns =&gt; columns.Bound(o =&gt; o.OrderDate).Filterable(false)))

Sets the server-side footer template for the column.

C#
public GridBoundColumnBuilder<T> FooterTemplate(Action<GridAggregateResult> template)
Parameters:templateAction<GridAggregateResult>

The action defining the template.

Returns:

GridBoundColumnBuilder<T>

Example:
C#
@(Html.Kendo().Grid&lt;User&gt;()
.Name("grid")
.Columns(columns =&gt;
{
columns.Bound(c =&gt; c.Name).FooterTemplate(x=&gt;x.Average);
}))

Sets the server-side footer template for the column.

C#
public GridBoundColumnBuilder<T> FooterTemplate(Func<GridAggregateResult, object> template)
Parameters:templateFunc<GridAggregateResult, object>

The action defining the template.

Returns:

GridBoundColumnBuilder<T>

Example:
C#
@(Html.Kendo().Grid&lt;User&gt;()
.Name("grid")
.Columns(columns =&gt;
{
columns.Bound(c =&gt; c.Name).FooterTemplate(@&lt;text&gt;Template&lt;/text&gt;);
}))

Gets or sets the format for displaying the data.

C#
public GridBoundColumnBuilder<T> Format(string value)
Parameters:valuestring

The value.

Returns:

GridBoundColumnBuilder<T>

Example:
C#
@(Html.Kendo().Grid(Model)
.Name("Grid")
.Columns(columns =&gt; columns.Bound(o =&gt; o.OrderDate).Format("{0:dd/MM/yyyy}")))

Sets the sort configuration when grouping.

C#
public GridBoundColumnBuilder<T> Groupable(Action<GridBoundColumnGroupableBuilder> configurator)
Parameters:configuratorAction<GridBoundColumnGroupableBuilder>Returns:

GridBoundColumnBuilder<T>

Example:
C#
@(Html.Kendo().Grid(Model)
.Name("Grid")
.Columns(columns =&gt; columns.Bound(o =&gt; o.OrderDate).Groupable(x =&gt; x.Sort(sort =&gt; sort.Dir(ListSortDirection.Ascending)))))

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

C#
public GridBoundColumnBuilder<T> Groupable(bool value)
Parameters:valueboolReturns:

GridBoundColumnBuilder<T>

Example:
C#
@(Html.Kendo().Grid(Model)
.Name("Grid")
.Columns(columns =&gt; columns.Bound(o =&gt; o.OrderDate).Groupable(false)))

Sets the server-side group footer template for the column.

C#
public GridBoundColumnBuilder<T> GroupFooterTemplate(Action<GridAggregateResult> template)
Parameters:templateAction<GridAggregateResult>

The action defining the template.

Returns:

GridBoundColumnBuilder<T>

Sets the server-side group footer template for the column.

C#
public GridBoundColumnBuilder<T> GroupFooterTemplate(Func<GridAggregateResult, object> template)
Parameters:templateFunc<GridAggregateResult, object>

The action defining the template.

Returns:

GridBoundColumnBuilder<T>

Example:
C#
@(Html.Kendo().Grid&lt;User&gt;()
.Name("grid")
.Columns(columns =&gt;
{
columns.Bound(c =&gt; c.Name).GroupFooterTemplate(x=&gt;x.Average);
}))

Sets the server-side group header column template for the column.

C#
public GridBoundColumnBuilder<T> GroupHeaderColumnTemplate(Action<GridAggregateResult> template)
Parameters:templateAction<GridAggregateResult>

The action defining the template.

Returns:

GridBoundColumnBuilder<T>

Example:
C#
@(Html.Kendo().Grid&lt;User&gt;()
.Name("grid")
.Columns(columns =&gt;
{
columns.Bound(c =&gt; c.Name).GroupHeaderColumnTemplate(@&lt;text&gt; Template &lt;/text&gt;);
}))

Sets the server-side group header column template for the column.

C#
public GridBoundColumnBuilder<T> GroupHeaderColumnTemplate(Func<GridAggregateResult, object> template)
Parameters:templateFunc<GridAggregateResult, object>

The action defining the template.

Returns:

GridBoundColumnBuilder<T>

Example:
C#
@(Html.Kendo().Grid&lt;User&gt;()
.Name("grid")
.Columns(columns =&gt;
{
columns.Bound(c =&gt; c.Name).GroupHeaderColumnTemplate(x=&gt;x.Count);
}))

Sets the server-side group footer template for the column.

C#
public GridBoundColumnBuilder<T> GroupHeaderTemplate(Action<GridGroupAggregateResult> template)
Parameters:templateAction<GridGroupAggregateResult>

The action defining the template.

Returns:

GridBoundColumnBuilder<T>

Sets the server-side group footer template for the column.

C#
public GridBoundColumnBuilder<T> GroupHeaderTemplate(Func<GridGroupAggregateResult, object> template)
Parameters:templateFunc<GridGroupAggregateResult, object>

The action defining the template.

Returns:

GridBoundColumnBuilder<T>

Example:
C#
@(Html.Kendo().Grid&lt;User&gt;()
.Name("grid")
.Columns(columns =&gt;
{
columns.Bound(c =&gt; c.Name).GroupHeaderTemplate(x=&gt;x.Count);
}))

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.

C#
public GridBoundColumnBuilder<T> HideOnGroup(bool value)
Parameters:valueboolReturns:

GridBoundColumnBuilder<T>

Example:
C#
@(Html.Kendo().Grid&lt;User&gt;()
.Name("grid")
.Columns(columns =&gt;
{
columns.Bound(c =&gt; c.Name).HideOnGroup(true);
}))

Configures the sorting functionality of the column.

C#
public GridBoundColumnBuilder<T> Sortable(Action<GridBoundColumnSortableBuilder> configurator)
Parameters:configuratorAction<GridBoundColumnSortableBuilder>Returns:

GridBoundColumnBuilder<T>

Example:
C#
@(Html.Kendo().Grid(Model)
.Name("Grid")
.Columns(columns =&gt; columns.Bound(x =&gt; x.Name).Sortable(s =&gt; s.AllowUnsort(true))))

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

C#
public GridBoundColumnBuilder<T> Sortable(bool value)
Parameters:valueboolReturns:

GridBoundColumnBuilder<T>

Example:
C#
@(Html.Kendo().Grid(Model)
.Name("Grid")
.Columns(columns =&gt; columns.Bound(o =&gt; o.OrderDate).Sortable(false)))

Sets the server-side template for the column.

C#
public GridBoundColumnBuilder<T> Template(Action<T> templateAction)
Parameters:templateActionAction<T>

The action defining the template.

Returns:

GridBoundColumnBuilder<T>

Example:
C#
@(Html.Kendo().Grid&lt;User&gt;()
.Name("grid")
.Columns(columns =&gt;
{
columns.Bound(c =&gt; c.Name).Template(@&lt;text&gt;
&lt;strong&gt;My Template&lt;/strong&gt;
&lt;/text&gt;);
}))

Sets the server-side template for the column.

C#
public GridBoundColumnBuilder<T> Template(Func<T, object> inlineTemplate)
Parameters:inlineTemplateFunc<T, object>

The action defining the template.

Returns:

GridBoundColumnBuilder<T>

Example:
C#
@(Html.Kendo().Grid&lt;User&gt;()
.Name("grid")
.Columns(columns =&gt;
{
columns.Bound(c =&gt; c.Name).Template(x=&gt;x.Name.ToUpper());
}))