New to Telerik UI for ASP.NET Core? 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, bool)GridColumnBuilder<IGridBoundColumn, GridBoundColumnBuilder<T>>.FooterHtmlAttributes(IDictionary<string, object>, bool)GridColumnBuilder<IGridBoundColumn, GridBoundColumnBuilder<T>>.IncludeInMenu(bool)GridColumnBuilder<IGridBoundColumn, GridBoundColumnBuilder<T>>.ClientHeaderTemplate(string)GridColumnBuilder<IGridBoundColumn, GridBoundColumnBuilder<T>>.ClientHeaderTemplateHandler(string)GridColumnBuilder<IGridBoundColumn, GridBoundColumnBuilder<T>>.ClientFooterTemplate(string)GridColumnBuilder<IGridBoundColumn, GridBoundColumnBuilder<T>>.ClientFooterTemplateHandler(string)GridColumnBuilder<IGridBoundColumn, GridBoundColumnBuilder<T>>.ClientGroupFooterTemplate(string)GridColumnBuilder<IGridBoundColumn, GridBoundColumnBuilder<T>>.ClientGroupFooterTemplateHandler(string)GridColumnBuilder<IGridBoundColumn, GridBoundColumnBuilder<T>>.ClientGroupFooterTemplateView(IHtmlContent)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>>.ColumnMenu(bool)GridColumnBuilderBase<IGridBoundColumn, GridBoundColumnBuilder<T>>.Exportable(bool)GridColumnBuilderBase<IGridBoundColumn, GridBoundColumnBuilder<T>>.Exportable(Action<GridColumnExportableBuilder>)GridColumnBuilderBase<IGridBoundColumn, GridBoundColumnBuilder<T>>.Resizable(bool)GridColumnBuilderBase<IGridBoundColumn, GridBoundColumnBuilder<T>>.MergeAttributes(IDictionary<string, object>, IDictionary<string, object>)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 view context.

urlGeneratorIUrlGenerator

The URL generator.

Methods

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>

Returns the current GridBoundColumnBuilder<T> instance for method chaining.

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>

Returns the current GridBoundColumnBuilder<T> instance for method chaining.

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

The JavaScript function that returns the client group header column template for the column.

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

The JavaScript function name.

Returns:

GridBoundColumnBuilder<T>

Returns the current GridBoundColumnBuilder<T> instance for method chaining.

Sets the client group template for the column.

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

The template

Returns:

GridBoundColumnBuilder<T>

Returns the current GridBoundColumnBuilder<T> instance for method chaining.

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

The JavaScript function that returns the client group header template for the column.

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

The JavaScript function name.

Returns:

GridBoundColumnBuilder<T>

Returns the current GridBoundColumnBuilder<T> instance for method chaining.

Sets the client group header template for the column.

C#
public GridBoundColumnBuilder<T> ClientGroupHeaderTemplateView(IHtmlContent value)
Parameters:valueIHtmlContent

The partial view that will be rendered within the template.

Returns:

GridBoundColumnBuilder<T>

Returns the current GridBoundColumnBuilder<T> instance for method chaining.

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

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 TemplateBuilder<TModel>.

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

The template builder.

Returns:

GridBoundColumnBuilder<T>

Returns the current GridBoundColumnBuilder<T> instance for method chaining.

The JavaScript function that returns the client template for the column.

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

The JavaScript function name.

Returns:

GridBoundColumnBuilder<T>

Returns the current GridBoundColumnBuilder<T> instance for method chaining.

Sets the client template id for the column.

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

The template id

Returns:

GridBoundColumnBuilder<T>

Returns the current GridBoundColumnBuilder<T> instance for method chaining.

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

Sets the client template for the column.

C#
public GridBoundColumnBuilder<T> ClientTemplateView(IHtmlContent value)
Parameters:valueIHtmlContent

The template view

Returns:

GridBoundColumnBuilder<T>

Returns the current GridBoundColumnBuilder<T> instance for method chaining.

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

Sets the editable function.

C#
public GridBoundColumnBuilder<T> Editable(Func<object, object> editable)
Parameters:editableFunc<object, object>

The editable function in a text tag.

Returns:

GridBoundColumnBuilder<T>

Returns the current GridBoundColumnBuilder<T> instance for method chaining.

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 editable)
Parameters:editablestring

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

Returns:

GridBoundColumnBuilder<T>

Returns the current GridBoundColumnBuilder<T> instance for method chaining.

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

Sets the name of the component to be used as an editor template for the column.

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

GridBoundColumnBuilder<T>

Returns the current GridBoundColumnBuilder<T> instance for method chaining.

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>

Returns the current GridBoundColumnBuilder<T> instance for method chaining.

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>

Returns the current GridBoundColumnBuilder<T> instance for method chaining.

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>

Returns the current GridBoundColumnBuilder<T> instance for method chaining.

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>

Returns the current GridBoundColumnBuilder<T> instance for method chaining.

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

Gets or sets the format for displaying the data.

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

The value.

Returns:

GridBoundColumnBuilder<T>

Returns the current GridBoundColumnBuilder<T> instance for method chaining.

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>

Returns the current GridBoundColumnBuilder<T> instance for method chaining.

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>

Returns the current GridBoundColumnBuilder<T> instance for method chaining.

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

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>

Returns the current GridBoundColumnBuilder<T> instance for method chaining.

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>

Returns the current GridBoundColumnBuilder<T> instance for method chaining.

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>

Returns the current GridBoundColumnBuilder<T> instance for method chaining.

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