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

Defines the fluent API for configuring the Kendo UI Grid

Definition

Namespace:Kendo.Mvc.UI.Fluent

Assembly:Kendo.Mvc.dll

Type Parameters:

T

Syntax:

C#
public class GridBuilder<T> : WidgetBuilderBase<Grid<T>, GridBuilder<T>>, IHtmlContent where T : class

Inheritance: objectHelperResultWidgetBuilderBase<Grid<T>, GridBuilder<T>>GridBuilder<T>

Implements: IHtmlContent

Inherited Members WidgetBuilderBase<Grid<T>, GridBuilder<T>>.ToComponent()WidgetBuilderBase<Grid<T>, GridBuilder<T>>.Expression(string)WidgetBuilderBase<Grid<T>, GridBuilder<T>>.Explorer(ModelExplorer)WidgetBuilderBase<Grid<T>, GridBuilder<T>>.Name(string)WidgetBuilderBase<Grid<T>, GridBuilder<T>>.Deferred(bool)WidgetBuilderBase<Grid<T>, GridBuilder<T>>.HtmlAttributes(object)WidgetBuilderBase<Grid<T>, GridBuilder<T>>.HtmlAttributes(IDictionary<string, object>)WidgetBuilderBase<Grid<T>, GridBuilder<T>>.ScriptAttributes(object, bool)WidgetBuilderBase<Grid<T>, GridBuilder<T>>.ScriptAttributes(IDictionary<string, object>, bool)WidgetBuilderBase<Grid<T>, GridBuilder<T>>.Render()WidgetBuilderBase<Grid<T>, GridBuilder<T>>.ToHtmlString()WidgetBuilderBase<Grid<T>, GridBuilder<T>>.WriteTo(TextWriter, HtmlEncoder)WidgetBuilderBase<Grid<T>, GridBuilder<T>>.ToClientTemplate()WidgetBuilderBase<Grid<T>, GridBuilder<T>>.AsModule(bool)WidgetBuilderBase<Grid<T>, GridBuilder<T>>.ComponentWidgetBuilderBase<Grid<T>, GridBuilder<T>>.ContainerHelperResult.WriteTo(TextWriter, HtmlEncoder)HelperResult.WriteActionobject.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 GridBuilder<T> class.

C#
public GridBuilder(Grid<T> component)
Parameters:componentGrid<T>

The component.

Methods

Specifies the adaptive rendering of the component.

C#
public GridBuilder<T> AdaptiveMode(AdaptiveMode value)
Parameters:valueAdaptiveMode

The value for AdaptiveMode

Returns:

GridBuilder<T>

Returns the current GridBuilder<T> instance.

Defines the configuration options for the AI tools in the Grid.

C#
public GridBuilder<T> AI(Action<GridAiSettingsBuilder<T>> configurator)
Parameters:configuratorAction<GridAiSettingsBuilder<T>>

The GridAiSettingsBuilder<T> for the ai setting.

Returns:

GridBuilder<T>

Returns the current instance of GridBuilder<T> .

If set to true and selection of the Grid is enabled, the user could copy the selection into the clipboard and paste it into Excel or other similar programs that understand TSV/CSV formats. By default allowCopy is disabled and the default format is TSV. Can be set to a JavaScript object which represents the allowCopy configuration.

C#
public GridBuilder<T> AllowCopy()
Returns:

GridBuilder<T>

Returns the current instance of GridAllowCopySettingsBuilder<T> .

If set to true and selection of the Grid is enabled, the user could copy the selection into the clipboard and paste it into Excel or other similar programs that understand TSV/CSV formats. By default allowCopy is disabled and the default format is TSV. Can be set to a JavaScript object which represents the allowCopy configuration.

C#
public GridBuilder<T> AllowCopy(Action<GridAllowCopySettingsBuilder<T>> configurator)
Parameters:configuratorAction<GridAllowCopySettingsBuilder<T>>

The GridAllowCopySettingsBuilder<T> for the allowcopy setting.

Returns:

GridBuilder<T>

Returns the current instance of GridBuilder<T> .

If set to true and selection of the Grid is enabled, the user could copy the selection into the clipboard and paste it into Excel or other similar programs that understand TSV/CSV formats. By default allowCopy is disabled and the default format is TSV. Can be set to a JavaScript object which represents the allowCopy configuration.

C#
public GridBuilder<T> AllowCopy(bool enabled)
Parameters:enabledbool

Enables or disables the allowcopy option.

Returns:

GridBuilder<T>

Returns the current instance of GridAllowCopySettingsBuilder<T> .

If set to true and the selection functionality of the Grid is enabled, the user can paste the current textual content of the clipboard into the Grid.

C#
public GridBuilder<T> AllowPaste()
Returns:

GridBuilder<T>

Returns the current GridBuilder<T> instance.

If set to true and the selection functionality of the Grid is enabled, the user can paste the current textual content of the clipboard into the Grid.

C#
public GridBuilder<T> AllowPaste(bool value)
Parameters:valuebool

The value for AllowPaste

Returns:

GridBuilder<T>

Returns the current GridBuilder<T> instance.

If set to false, the Grid will not bind to the data source during initialization, i.e. it will not call the fetch method of the dataSource instance. In such scenarios data binding will occur when the change event of the dataSource instance is fired. By default, autoBind is set to true and the widget will bind to the data source specified in the configuration.

C#
public GridBuilder<T> AutoBind(bool value)
Parameters:valuebool

The value for AutoBind

Returns:

GridBuilder<T>

Returns the current GridBuilder<T> instance.

Binds the grid to a list of objects

C#
public GridBuilder<T> BindTo(IEnumerable dataSource)
Parameters:dataSourceIEnumerable

The data source.

Returns:

GridBuilder<T>

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

Example:
C#
@model IEnumerable;
@(Html.Kendo().Grid&lt;Product&gt;()
.Name("grid")
.BindTo(Model)
)

Binds the grid to a list of objects

C#
public GridBuilder<T> BindTo(IEnumerable<T> dataSource)
Parameters:dataSourceIEnumerable<T>

The data source.

Returns:

GridBuilder<T>

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

Example:
C#
@model IEnumerable&lt;Product&gt;
@(Html.Kendo().Grid&lt;Product&gt;()
.Name("grid")
.BindTo(Model)
)

Sets the client-side alt row template of the grid. The client-side row template must contain a table row element (tr).

C#
public GridBuilder<T> ClientAltRowTemplate(Func<Grid<T>, string> template)
Parameters:templateFunc<Grid<T>, string>

The template

Returns:

GridBuilder<T>

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

Example:
C#
@(Html.Kendo().Grid&lt;Product&gt;()
.Name("grid")
.DataSource(dataSource =&gt;
// configure the data source
dataSource
.Ajax()
.Read(read =&gt; read.Action("Products_Read", "Home"))
)
.ClientAltRowTemplate(grid =&gt;
"&lt;tr&gt;" +
"&lt;td&gt;#: ProductName #&lt;/td&gt;" +
"&lt;td&gt;#: UnitsInStock #&lt;/td&gt;" +
"&lt;/tr&gt;"
)
)

Sets the client-side alt row template of the grid. The client-side alt row template must contain a table row element (tr).

C#
public GridBuilder<T> ClientAltRowTemplate(string template)
Parameters:templatestring

The template

Returns:

GridBuilder<T>

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

Example:
C#
@(Html.Kendo().Grid&lt;Product&gt;()
.Name("grid")
.DataSource(dataSource =&gt;
// configure the data source
dataSource
.Ajax()
.Read(read =&gt; read.Action("Products_Read", "Home"))
)
.ClientAltRowTemplate(
"&lt;tr class='k-alt'&gt;" +
"&lt;td&gt;#: ProductName #&lt;/td&gt;" +
"&lt;td&gt;#: UnitsInStock #&lt;/td&gt;" +
"&lt;/tr&gt;"
)
)

Sets the client-side alt row template of the grid. The client-side row template must contain a table row element (tr).

C#
public GridBuilder<T> ClientAltRowTemplate<TModel>(TemplateBuilder<TModel> template)
Parameters:templateTemplateBuilder<TModel>

The template TemplateBuilder<TModel>

Returns:

GridBuilder<T>

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

The JavaScript function that returns the client-side alt row template of the grid. The client-side alt row template must contain a table row element (tr).

C#
public GridBuilder<T> ClientAltRowTemplateHandler(string template)
Parameters:templatestringReturns:

GridBuilder<T>

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

Sets the client-side detail template of the grid.

C#
public GridBuilder<T> ClientDetailTemplate<TModel>(TemplateBuilder<TModel> template)
Parameters:templateTemplateBuilder<TModel>

The template TemplateBuilder<TModel>

Returns:

GridBuilder<T>

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

The JavaScript function that returns the client-side detail template of the grid.

C#
public GridBuilder<T> ClientDetailTemplateHandler(string handler)
Parameters:handlerstringReturns:

GridBuilder<T>

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

Sets the id of the script element which contains the client-side detail template of the grid.

C#
public GridBuilder<T> ClientDetailTemplateId(string id)
Parameters:idstring

The id

Returns:

GridBuilder<T>

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

Example:
C#
@(Html.Kendo().Grid&lt;Product&gt;()
.Name("grid")
.DataSource(dataSource =&gt;
// configure the data source
dataSource
.Ajax()
.Read(read =&gt; read.Action("Products_Read", "Home"))
)
.ClientDetailTemplateId("detail-template")
)
&lt;script id="detail-template" type="text/x-kendo-template"&gt;
Product Details:
&lt;div&gt;Product Name: #: ProductName # &lt;/div&gt;
&lt;div&gt;Units In Stock: #: UnitsInStock #&lt;/div&gt;
&lt;/script&gt;

Sets the client-side detail template of the grid.

C#
public GridBuilder<T> ClientDetailTemplateView(IHtmlContent templateView)
Parameters:templateViewIHtmlContent

The template view

Returns:

GridBuilder<T>

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

Example:
C#
@(Html.Kendo().Grid&lt;Product&gt;()
.Name("grid")
.DataSource(dataSource =&gt;
// configure the data source
dataSource
.Ajax()
.Read(read =&gt; read.Action("Products_Read", "Home"))
)
.ClientDetailTemplateView(Html.Partial("detail-template"))
)
&lt;script id="detail-template" type="text/x-kendo-template"&gt;
Product Details:
&lt;div&gt;Product Name: #: ProductName # &lt;/div&gt;
&lt;div&gt;Units In Stock: #: UnitsInStock #&lt;/div&gt;
&lt;/script&gt;

Sets the client-side row template of the grid. The client-side row template must contain a table row element (tr).

C#
public GridBuilder<T> ClientRowTemplate(Func<Grid<T>, string> template)
Parameters:templateFunc<Grid<T>, string>

The template

Returns:

GridBuilder<T>

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

Example:
C#
@(Html.Kendo().Grid&lt;Product&gt;()
.Name("grid")
.DataSource(dataSource =&gt;
// configure the data source
dataSource
.Ajax()
.Read(read =&gt; read.Action("Products_Read", "Home"))
)
.ClientRowTemplate(grid =&gt;
"&lt;tr&gt;" +
"&lt;td&gt;#: ProductName #&lt;/td&gt;" +
"&lt;td&gt;#: UnitsInStock #&lt;/td&gt;" +
"&lt;/tr&gt;"
)
)

Sets the client-side row template of the grid. The client-side row template must contain a table row element (tr).

C#
public GridBuilder<T> ClientRowTemplate(string template)
Parameters:templatestring

The template

Returns:

GridBuilder<T>

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

Example:
C#
@(Html.Kendo().Grid&lt;Product&gt;()
.Name("grid")
.DataSource(dataSource =&gt;
// configure the data source
dataSource
.Ajax()
.Read(read =&gt; read.Action("Products_Read", "Home"))
)
.ClientRowTemplate(
"&lt;tr&gt;" +
"&lt;td&gt;#: ProductName #&lt;/td&gt;" +
"&lt;td&gt;#: UnitsInStock #&lt;/td&gt;" +
"&lt;/tr&gt;"
)
)

Sets the client-side row template of the grid. The client-side row template must contain a table row element (tr).

C#
public GridBuilder<T> ClientRowTemplate<TModel>(TemplateBuilder<TModel> template)
Parameters:templateTemplateBuilder<TModel>

The template TemplateBuilder<TModel>

Returns:

GridBuilder<T>

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

The JavaScript function that returns the client-side row template of the grid. The client-side row template must contain a table row element (tr).

C#
public GridBuilder<T> ClientRowTemplateHandler(string value)
Parameters:valuestring

The name of the JavaScript function.

Returns:

GridBuilder<T>

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

If set to true the grid will display the column menu when the user clicks the chevron icon in the column headers. The column menu allows the user to show and hide columns, filter and sort (if filtering and sorting are enabled). By default the column menu is not enabled.Can be set to a JavaScript object which represents the column menu configuration.

C#
public GridBuilder<T> ColumnMenu()
Returns:

GridBuilder<T>

Returns the current instance of GridColumnMenuSettingsBuilder<T> .

If set to true the grid will display the column menu when the user clicks the chevron icon in the column headers. The column menu allows the user to show and hide columns, filter and sort (if filtering and sorting are enabled). By default the column menu is not enabled.Can be set to a JavaScript object which represents the column menu configuration.

C#
public GridBuilder<T> ColumnMenu(Action<GridColumnMenuSettingsBuilder<T>> configurator)
Parameters:configuratorAction<GridColumnMenuSettingsBuilder<T>>

The GridColumnMenuSettingsBuilder<T> for the columnmenu setting.

Returns:

GridBuilder<T>

Returns the current instance of GridBuilder<T> .

If set to true the grid will display the column menu when the user clicks the chevron icon in the column headers. The column menu allows the user to show and hide columns, filter and sort (if filtering and sorting are enabled). By default the column menu is not enabled.Can be set to a JavaScript object which represents the column menu configuration.

C#
public GridBuilder<T> ColumnMenu(bool enabled)
Parameters:enabledbool

Enables or disables the columnmenu option.

Returns:

GridBuilder<T>

Returns the current instance of GridColumnMenuSettingsBuilder<T> .

Defines the width of the column resize handle in pixels. Apply a larger value for easier grasping.

C#
public GridBuilder<T> ColumnResizeHandleWidth(double value)
Parameters:valuedouble

The value for ColumnResizeHandleWidth

Returns:

GridBuilder<T>

Returns the current GridBuilder<T> instance.

Sets the column configuration of the grid.

C#
public GridBuilder<T> Columns(Action<GridColumnFactory<T>> configurator)
Parameters:configuratorAction<GridColumnFactory<T>>

The lambda which configures columns

Returns:

GridBuilder<T>

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

Example:
C#
@(Html.Kendo().Grid&lt;Product&gt;()
.Name("grid")
.Columns(columns =&gt;
{
columns.Bound(product =&gt; product.ProductName).Title("Product Name");
columns.Command(command =&gt; command.Destroy());
})
.DataSource(dataSource =&gt;
// configure the data source
dataSource
.Ajax()
.Destroy(destroy =&gt; destroy.Action("Products_Destroy", "Home"))
.Read(read =&gt; read.Action("Products_Read", "Home"))
)
)

Enables the Grid's Context Menu.

C#
public GridBuilder<T> ContextMenu()
Returns:

GridBuilder<T>

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

Example:
C#
@(Html.Kendo().Grid&lt;Product&gt;()
.Name("grid")
.ContextMenu()
.DataSource(dataSource =&gt;
// configure the data source
dataSource
.Ajax()
.Read(read =&gt; read.Action("Products_Read", "Home"))
)
)

Sets the ContextMenu configuration of the grid.

C#
public GridBuilder<T> ContextMenu(Action<GridContextMenuBuilder> configurator)
Parameters:configuratorAction<GridContextMenuBuilder>

The lambda which configures the Context Menu

Returns:

GridBuilder<T>

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

Example:
C#
@(Html.Kendo().Grid&lt;Product&gt;()
.Name("Grid")
.DataSource(dataSource =&gt;
// configure the data source
dataSource
.Ajax()
.Read(read =&gt; read.Action("Products_Read", "Home"))
)
.ContextMenu(menu =&gt; menu.Body(body =&gt; body.ExportPDF()))
)

Defines the data layout mode of the grid.

C#
public GridBuilder<T> DataLayoutMode(DataLayoutMode value)
Parameters:valueDataLayoutMode

The value for DataLayoutMode

Returns:

GridBuilder<T>

Returns the current GridBuilder<T> instance.

Sets the data source configuration of the grid.

C#
public GridBuilder<T> DataSource(Action<DataSourceBuilder<T>> configurator)
Parameters:configuratorAction<DataSourceBuilder<T>>

The lambda which configures the data source

Returns:

GridBuilder<T>

Example:
C#
@(Html.Kendo().Grid&lt;Product&gt;()
.Name("grid")
.DataSource(dataSource =&gt;
// configure the data source
dataSource
.Ajax()
.Read(read =&gt; read.Action("Products_Read", "Home"))
)
)

Sets the ID of the DataSource widget used by the Grid.

C#
public GridBuilder<T> DataSource(string dataSourceId)
Parameters:dataSourceIdstring

The name of the DataSource

Returns:

GridBuilder<T>

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

Example:
C#
@(Html.Kendo().Grid&lt;Product&gt;()
.Name("grid")
.DataSource("dataSource1")
)
@(Html.Kendo().DataSource&lt;Product&gt;()
.Name("dataSource1")
.Ajax(ds=&gt;ds
.Read(read =&gt; read.Action("Products_Read", "Home"))
.PageSize(20)
)
)

Enables grid editing.

C#
public GridBuilder<T> Editable()
Returns:

GridBuilder<T>

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

Example:
C#
@(Html.Kendo().Grid&lt;Product&gt;()
.Name("Grid")
.DataSource(dataSource =&gt;
// configure the data source
dataSource
.Ajax()
.Read(read =&gt; read.Action("Products_Read", "Home"))
)
.Editable()
)

Sets the editing configuration of the grid.

C#
public GridBuilder<T> Editable(Action<GridEditingSettingsBuilder<T>> configurator)
Parameters:configuratorAction<GridEditingSettingsBuilder<T>>

The lambda which configures the editing

Returns:

GridBuilder<T>

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

Example:
C#
@(Html.Kendo().Grid&lt;Product&gt;()
.Name("Grid")
.DataSource(dataSource =&gt;
// configure the data source
dataSource
.Ajax()
.Read(read =&gt; read.Action("Products_Read", "Home"))
)
.Editable(editing =&gt; editing.Mode(GridEditMode.PopUp))
)

Sets the edit mode of the grid.

C#
public GridBuilder<T> Editable(GridEditMode editMode)
Parameters:editModeGridEditMode

The lambda which configures the editing

Returns:

GridBuilder<T>

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

Example:
C#
@(Html.Kendo().Grid&lt;Product&gt;()
.Name("Grid")
.DataSource(dataSource =&gt;
// configure the data source
dataSource
.Ajax()
.Read(read =&gt; read.Action("Products_Read", "Home"))
)
.Editable(editing =&gt; editing.Mode(GridEditMode.PopUp))
)

If set to true the grid will perform custom binding.

C#
public GridBuilder<T> EnableCustomBinding(bool value)
Parameters:valuebool

If true enables custom binding.

Returns:

GridBuilder<T>

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

Example:
C#
@(Html.Kendo().Grid&lt;Product&gt;()
.Name("grid")
.EnableCustomBinding(true)
.DataSource(dataSource =&gt;
// configure the data source
dataSource
.Ajax()
.Read(read =&gt; read.Action("Products_Read", "Home"))
)
)

If set to true the column title will be HTML-encoded before it is displayed. If set to false the column title will be displayed as is.

C#
public GridBuilder<T> EncodeTitles()
Returns:

GridBuilder<T>

Returns the current GridBuilder<T> instance.

If set to true the column title will be HTML-encoded before it is displayed. If set to false the column title will be displayed as is.

C#
public GridBuilder<T> EncodeTitles(bool value)
Parameters:valuebool

The value for EncodeTitles

Returns:

GridBuilder<T>

Returns the current GridBuilder<T> instance.

Configures the client-side events.

C#
public GridBuilder<T> Events(Action<GridEventBuilder> configurator)
Parameters:configuratorAction<GridEventBuilder>

The client events action.

Returns:

GridBuilder<T>

Returns the current GridBuilder<T> instance.

Example:
C#
@(Html.Kendo().Grid()
.Name("Grid")
.Events(events =&gt; events
.BeforeEdit("onBeforeEdit")
)
)

Configures the Kendo UI Grid Excel export settings.

C#
public GridBuilder<T> Excel(Action<GridExcelSettingsBuilder<T>> configurator)
Parameters:configuratorAction<GridExcelSettingsBuilder<T>>

The GridExcelSettingsBuilder<T> for the excel setting.

Returns:

GridBuilder<T>

Returns the current instance of GridBuilder<T> .

Enables grid filtering.

C#
public GridBuilder<T> Filterable()
Returns:

GridBuilder<T>

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

Example:
C#
@(Html.Kendo().Grid&lt;Product&gt;()
.Name("grid")
.Filterable()
.DataSource(dataSource =&gt;
// configure the data source
dataSource
.Ajax()
.Read(read =&gt; read.Action("Products_Read", "Home"))
)
)

Sets the filtering configuration of the grid.

C#
public GridBuilder<T> Filterable(Action<GridFilterableSettingsBuilder> configurator)
Parameters:configuratorAction<GridFilterableSettingsBuilder>

The lambda which configures the filtering

Returns:

GridBuilder<T>

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

Example:
C#
@(Html.Kendo().Grid&lt;Product&gt;()
.Name("grid")
.Filterable(filtering =&gt; filtering.Enabled(true))
.DataSource(dataSource =&gt;
// configure the data source
dataSource
.Ajax()
.Read(read =&gt; read.Action("Products_Read", "Home"))
)
)

If set to true the user could group the grid by dragging the column header cells. By default grouping is disabled.Can be set to a JavaScript object which represents the grouping configuration.

C#
public GridBuilder<T> Groupable()
Returns:

GridBuilder<T>

Returns the current instance of GridGroupableSettingsBuilder<T> .

If set to true the user could group the grid by dragging the column header cells. By default grouping is disabled.Can be set to a JavaScript object which represents the grouping configuration.

C#
public GridBuilder<T> Groupable(Action<GridGroupableSettingsBuilder<T>> configurator)
Parameters:configuratorAction<GridGroupableSettingsBuilder<T>>

The GridGroupableSettingsBuilder<T> for the groupable setting.

Returns:

GridBuilder<T>

Returns the current instance of GridBuilder<T> .

If set to true the user could group the grid by dragging the column header cells. By default grouping is disabled.Can be set to a JavaScript object which represents the grouping configuration.

C#
public GridBuilder<T> Groupable(bool enabled)
Parameters:enabledbool

Enables or disables the groupable option.

Returns:

GridBuilder<T>

Returns the current instance of GridGroupableSettingsBuilder<T> .

Sets the height of the grid.

C#
public GridBuilder<T> Height(int pixelHeight)
Parameters:pixelHeightint

The height of the grid. Numeric values are treated as pixels.

Returns:

GridBuilder<T>

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

Example:
C#
@(Html.Kendo().Grid&lt;OrderViewModel&gt;()
.Name("grid")
.Columns(columns =&gt;
{
columns.Bound(p =&gt; p.OrderID).Filterable(false);
columns.Bound(p =&gt; p.Freight);
})
.Height(400)
.Pageable()
.DataSource(dataSource =&gt; dataSource
.Ajax()
.PageSize(10)
.Read(read =&gt; read.Action("Orders_Read", "Grid"))
)
)

Sets the height of the grid.

C#
public GridBuilder<T> Height(string value)
Parameters:valuestring

The height of the grid.

Returns:

GridBuilder<T>

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

Example:
C#
@(Html.Kendo().Grid&lt;OrderViewModel&gt;()
.Name("grid")
.Columns(columns =&gt;
{
columns.Bound(p =&gt; p.OrderID).Filterable(false);
columns.Bound(p =&gt; p.Freight);
})
.Height("400px")
.Pageable()
.DataSource(dataSource =&gt; dataSource
.Ajax()
.PageSize(10)
.Read(read =&gt; read.Action("Orders_Read", "Grid"))
)
)

Defines the type of the loader that will be displayed while loading the data

C#
public GridBuilder<T> LoaderType(GridLoaderType value)
Parameters:valueGridLoaderType

The value for LoaderType

Returns:

GridBuilder<T>

Returns the current GridBuilder<T> instance.

Configures the grid messages.

C#
public GridBuilder<T> Messages(Action<GridMessagesBuilder> configurator)
Parameters:configuratorAction<GridMessagesBuilder>

Defines the text of the messages used by the Grid

Returns:

GridBuilder<T>

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

Example:
C#
@(Html.Kendo().Grid&lt;OrderViewModel&gt;()
.Name("grid")
.Columns(columns =&gt;
{
columns.Bound(p =&gt; p.OrderID).Filterable(false);
columns.Bound(p =&gt; p.Freight);
})
.Messages(m =&gt; m.ExpandCollapseColumnHeader("E/C"))
.DataSource(dataSource =&gt; dataSource
.Ajax()
.PageSize(20)
.Read(read =&gt; read.Action("Orders_Read", "Grid"))
)
)

Enables the adaptive rendering when viewed on mobile browser

C#
public GridBuilder<T> Mobile()
Returns:

GridBuilder<T>

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

Example:
C#
@(Html.Kendo().Grid&lt;OrderViewModel&gt;()
.Name("grid")
.Columns(columns =&gt;
{
columns.Bound(p =&gt; p.OrderID).Filterable(false);
columns.Bound(p =&gt; p.Freight);
})
.Mobile()
.DataSource(dataSource =&gt; dataSource
.Ajax()
.PageSize(20)
.Read(read =&gt; read.Action("Orders_Read", "Grid"))
)
)

Used to determine if adaptive rendering should be used when viewed on mobile browser

C#
public GridBuilder<T> Mobile(MobileMode type)
Parameters:typeMobileMode

Defines the type of the Mobile Mode

Returns:

GridBuilder<T>

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

Currently the Grid widget doesn't distinguish between phone and tablet option.

Example:
C#
@(Html.Kendo().Grid&lt;OrderViewModel&gt;()
.Name("grid")
.Columns(columns =&gt;
{
columns.Bound(p =&gt; p.OrderID).Filterable(false);
columns.Bound(p =&gt; p.Freight);
})
.Mobile(MobileMode.Phone)
.DataSource(dataSource =&gt; dataSource
.Ajax()
.PageSize(20)
.Read(read =&gt; read.Action("Orders_Read", "Grid"))
)
)

If set to true the user could navigate the component using the keyboard navigation. By default keyboard navigation is disabled.

C#
public GridBuilder<T> Navigatable()
Returns:

GridBuilder<T>

Returns the current GridBuilder<T> instance.

If set to true the user could navigate the component using the keyboard navigation. By default keyboard navigation is disabled.

C#
public GridBuilder<T> Navigatable(bool value)
Parameters:valuebool

The value for Navigatable

Returns:

GridBuilder<T>

Returns the current GridBuilder<T> instance.

If set to true and current view contains no records, message similar to "No records available" will be displayed. By default this option is disabled.

C#
public GridBuilder<T> NoRecords()
Returns:

GridBuilder<T>

Returns the current instance of GridNoRecordsSettingsBuilder<T> .

If set to true and current view contains no records, message similar to "No records available" will be displayed. By default this option is disabled.

C#
public GridBuilder<T> NoRecords(Action<GridNoRecordsSettingsBuilder<T>> configurator)
Parameters:configuratorAction<GridNoRecordsSettingsBuilder<T>>

The GridNoRecordsSettingsBuilder<T> for the norecords setting.

Returns:

GridBuilder<T>

Returns the current instance of GridBuilder<T> .

If set to true and current view contains no records, message similar to "No records available" will be displayed. By default this option is disabled.

C#
public GridBuilder<T> NoRecords(bool enabled)
Parameters:enabledbool

Enables or disables the norecords option.

Returns:

GridBuilder<T>

Returns the current instance of GridNoRecordsSettingsBuilder<T> .

Enables grid paging.

C#
public GridBuilder<T> Pageable()
Returns:

GridBuilder<T>

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

Example:
C#
@(Html.Kendo().Grid&lt;Product&gt;()
.Name("grid")
.Pageable()
.DataSource(dataSource =&gt;
// configure the data source
dataSource
.Ajax()
.Read(read =&gt; read.Action("Products_Read", "Home"))
)
)

Sets the paging configuration of the grid.

C#
public GridBuilder<T> Pageable(Action<GridPageableSettingsBuilder> configurator)
Parameters:configuratorAction<GridPageableSettingsBuilder>

The lambda which configures the paging

Returns:

GridBuilder<T>

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

Example:
C#
@(Html.Kendo().Grid&lt;Product&gt;()
.Name("grid")
.Pageable(paging =&gt;
paging.Refresh(true)
)
.DataSource(dataSource =&gt;
// configure the data source
dataSource
.Ajax()
.Read(read =&gt; read.Action("Products_Read", "Home"))
)
)

Configures the Kendo UI Grid PDF export settings.

C#
public GridBuilder<T> Pdf(Action<GridPdfSettingsBuilder<T>> configurator)
Parameters:configuratorAction<GridPdfSettingsBuilder<T>>

The GridPdfSettingsBuilder<T> for the pdf setting.

Returns:

GridBuilder<T>

Returns the current instance of GridBuilder<T> .

Sets a value indicating whether the selection will be persisted when sorting, paging, filtering and etc are performed.

C#
public GridBuilder<T> PersistSelection()
Returns:

GridBuilder<T>

Returns the current GridBuilder<T> instance.

Sets a value indicating whether the selection will be persisted when sorting, paging, filtering and etc are performed.

C#
public GridBuilder<T> PersistSelection(bool value)
Parameters:valuebool

The value for PersistSelection

Returns:

GridBuilder<T>

Returns the current GridBuilder<T> instance.

Enables row pinning for the Grid. When enabled, rows can be pinned to the top or bottom of the Grid so they remain visible while scrolling through the remaining data. Pinned rows are rendered in dedicated containers above and below the scrollable content area.The pinnable option can be set to true to enable the feature without initially pinned rows, or to an object specifying which rows to pin by their ID values.

C#
public GridBuilder<T> Pinnable()
Returns:

GridBuilder<T>

Returns the current instance of GridPinnableSettingsBuilder<T> .

Enables row pinning for the Grid. When enabled, rows can be pinned to the top or bottom of the Grid so they remain visible while scrolling through the remaining data. Pinned rows are rendered in dedicated containers above and below the scrollable content area.The pinnable option can be set to true to enable the feature without initially pinned rows, or to an object specifying which rows to pin by their ID values.

C#
public GridBuilder<T> Pinnable(Action<GridPinnableSettingsBuilder<T>> configurator)
Parameters:configuratorAction<GridPinnableSettingsBuilder<T>>

The GridPinnableSettingsBuilder<T> for the pinnable setting.

Returns:

GridBuilder<T>

Returns the current instance of GridBuilder<T> .

Enables row pinning for the Grid. When enabled, rows can be pinned to the top or bottom of the Grid so they remain visible while scrolling through the remaining data. Pinned rows are rendered in dedicated containers above and below the scrollable content area.The pinnable option can be set to true to enable the feature without initially pinned rows, or to an object specifying which rows to pin by their ID values.

C#
public GridBuilder<T> Pinnable(bool enabled)
Parameters:enabledbool

Enables or disables the pinnable option.

Returns:

GridBuilder<T>

Returns the current instance of GridPinnableSettingsBuilder<T> .

A function that allows customizing the rendering of pinned rows. The function receives an object with two fields: dataItem (the data item for the row) and row (the default HTML string for the row). The function must return an HTML string.If not set, pinned rows use the same template as regular rows.

C#
public GridBuilder<T> PinnedRowTemplate<TModel>(TemplateBuilder<TModel> template)
Parameters:templateTemplateBuilder<TModel>

A Template component that configures the pinnedrowtemplate.

Returns:

GridBuilder<T>

Returns the current GridBuilder<T> instance.

A function that allows customizing the rendering of pinned rows. The function receives an object with two fields: dataItem (the data item for the row) and row (the default HTML string for the row). The function must return an HTML string.If not set, pinned rows use the same template as regular rows.

C#
public GridBuilder<T> PinnedRowTemplateHandler(string templateHandler)
Parameters:templateHandlerstring

The handler that returs the template for PinnedRowTemplate

Returns:

GridBuilder<T>

Returns the current GridBuilder<T> instance.

If set to true the grid will prefix the query string parameters with its name. The default value is false.

C#
public GridBuilder<T> PrefixUrlParameters(bool prefix)
Parameters:prefixboolReturns:

GridBuilder<T>

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

Example:
C#
@(Html.Kendo().Grid&lt;OrderViewModel&gt;()
.Name("grid")
.PrefixUrlParameters(true)
.Columns(columns =&gt;
{
columns.Bound(p =&gt; p.OrderID).Filterable(false);
columns.Bound(p =&gt; p.Freight);
})
.Size(ComponentSize.Small)
.Pageable()
.DataSource(dataSource =&gt; dataSource
.Ajax()
.PageSize(10)
.Read(read =&gt; read.Action("Orders_Read", "Grid"))
)
)

Sets the reordering configuration of the grid.

C#
public GridBuilder<T> Reorderable(Action<GridReorderingSettingsBuilder> configurator)
Parameters:configuratorAction<GridReorderingSettingsBuilder>

The lambda which configures the reordering

Returns:

GridBuilder<T>

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

Example:
C#
@(Html.Kendo().Grid&lt;Product&gt;()
.Name("Grid")
.DataSource(dataSource =&gt;
// configure the data source
dataSource
.Ajax()
.Read(read =&gt; read.Action("Products_Read", "Home"))
)
.Reorderable(reordering =&gt; reordering.Columns(true))
)

Sets the resizing configuration of the grid.

C#
public GridBuilder<T> Resizable(Action<GridResizingSettingsBuilder> configurator)
Parameters:configuratorAction<GridResizingSettingsBuilder>

The lambda which configures the resizing

Returns:

GridBuilder<T>

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

Example:
C#
@(Html.Kendo().Grid&lt;Product&gt;()
.Name("Grid")
.DataSource(dataSource =&gt;
// configure the data source
dataSource
.Ajax()
.Read(read =&gt; read.Action("Products_Read", "Home"))
)
.Resizable(resizing =&gt; resizing.Columns(true))
)

Enables grid scrolling.

C#
public GridBuilder<T> Scrollable()
Returns:

GridBuilder<T>

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

Example:
C#
@(Html.Kendo().Grid&lt;Product&gt;()
.Name("grid")
.Scrollable()
.DataSource(dataSource =&gt;
// configure the data source
dataSource
.Ajax()
.Read(read =&gt; read.Action("Products_Read", "Home"))
)
)

Sets the scrolling configuration of the grid.

C#
public GridBuilder<T> Scrollable(Action<GridScrollSettingsBuilder> configurator)
Parameters:configuratorAction<GridScrollSettingsBuilder>

The lambda which configures the scrolling

Returns:

GridBuilder<T>

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

Example:
C#
@(Html.Kendo().Grid&lt;Product&gt;()
.Name("grid")
.Scrollable(scrolling =&gt; scrolling.Enabled(true))
.DataSource(dataSource =&gt;
// configure the data source
dataSource
.Ajax()
.Read(read =&gt; read.Action("Products_Read", "Home"))
)
)

Configures the Kendo UI Grid search bar settings.

C#
public GridBuilder<T> Search(Action<GridSearchSettingsBuilder<T>> configurator)
Parameters:configuratorAction<GridSearchSettingsBuilder<T>>

The GridSearchSettingsBuilder<T> for the search setting.

Returns:

GridBuilder<T>

Returns the current instance of GridBuilder<T> .

Enables grid row selection.

C#
public GridBuilder<T> Selectable()
Returns:

GridBuilder<T>

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

Example:
C#
@(Html.Kendo().Grid&lt;Product&gt;()
.Name("grid")
.Selectable()
.DataSource(dataSource =&gt;
// configure the data source
dataSource
.Ajax()
.Read(read =&gt; read.Action("Products_Read", "Home"))
)
)

Sets the selection configuration of the grid.

C#
public GridBuilder<T> Selectable(Action<GridSelectionSettingsBuilder> configurator)
Parameters:configuratorAction<GridSelectionSettingsBuilder>

The lambda which configures the selection

Returns:

GridBuilder<T>

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

Example:
C#
@(Html.Kendo().Grid&lt;Product&gt;()
.Name("grid")
.Selectable(selection =&gt; selection.Enabled(true))
.DataSource(dataSource =&gt;
// configure the data source
dataSource
.Ajax()
.Read(read =&gt; read.Action("Products_Read", "Home"))
)
)

Sets the size of the grid.

C#
public GridBuilder<T> Size(ComponentSize? value)
Parameters:valueComponentSize?

The size of the grid.

Returns:

GridBuilder<T>

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

Example:
C#
@(Html.Kendo().Grid&lt;OrderViewModel&gt;()
.Name("grid")
.Columns(columns =&gt;
{
columns.Bound(p =&gt; p.OrderID).Filterable(false);
columns.Bound(p =&gt; p.Freight);
})
.Size(ComponentSize.Small)
.Pageable()
.DataSource(dataSource =&gt; dataSource
.Ajax()
.PageSize(10)
.Read(read =&gt; read.Action("Orders_Read", "Grid"))
)
)

Defines the configuration options for the SmartBox tool in the Grid. The SmartBox provides a unified interface for search, semantic search, and AI assistant capabilities.

C#
public GridBuilder<T> SmartBox(Action<GridSmartBoxSettingsBuilder<T>> configurator)
Parameters:configuratorAction<GridSmartBoxSettingsBuilder<T>>

The GridSmartBoxSettingsBuilder<T> for the smartbox setting.

Returns:

GridBuilder<T>

Returns the current instance of GridBuilder<T> .

If set to true the user could sort the grid by clicking the column header cells. By default sorting is disabled.Can be set to a JavaScript object which represents the sorting configuration.

C#
public GridBuilder<T> Sortable()
Returns:

GridBuilder<T>

Returns the current instance of GridSortableSettingsBuilder<T> .

If set to true the user could sort the grid by clicking the column header cells. By default sorting is disabled.Can be set to a JavaScript object which represents the sorting configuration.

C#
public GridBuilder<T> Sortable(Action<GridSortableSettingsBuilder<T>> configurator)
Parameters:configuratorAction<GridSortableSettingsBuilder<T>>

The GridSortableSettingsBuilder<T> for the sortable setting.

Returns:

GridBuilder<T>

Returns the current instance of GridBuilder<T> .

If set to true the user could sort the grid by clicking the column header cells. By default sorting is disabled.Can be set to a JavaScript object which represents the sorting configuration.

C#
public GridBuilder<T> Sortable(bool enabled)
Parameters:enabledbool

Enables or disables the sortable option.

Returns:

GridBuilder<T>

Returns the current instance of GridSortableSettingsBuilder<T> .

The stacked layout settings of the Grid.

C#
public GridBuilder<T> StackedLayoutSettings(Action<GridStackedLayoutSettingsSettingsBuilder<T>> configurator)
Parameters:configuratorAction<GridStackedLayoutSettingsSettingsBuilder<T>>

The GridStackedLayoutSettingsSettingsBuilder<T> for the stackedlayoutsettings setting.

Returns:

GridBuilder<T>

Returns the current instance of GridBuilder<T> .

The template which renders the Status Bar/Aggregates Bar.

C#
public GridBuilder<T> StatusBarTemplate<TModel>(TemplateBuilder<TModel> template)
Parameters:templateTemplateBuilder<TModel>

A Template component that configures the statusbartemplate.

Returns:

GridBuilder<T>

Returns the current GridBuilder<T> instance.

The template which renders the Status Bar/Aggregates Bar.

C#
public GridBuilder<T> StatusBarTemplateHandler(string templateHandler)
Parameters:templateHandlerstring

The handler that returs the template for StatusBarTemplate

Returns:

GridBuilder<T>

Returns the current GridBuilder<T> instance.

Sets the toolbar configuration of the grid. Set the list of commands displayed in the Grid's Toolbar. Supports adding custom or built-in commands.

C#
public GridBuilder<T> ToolBar(Action<GridToolBarCommandFactory<T>> configurator)
Parameters:configuratorAction<GridToolBarCommandFactory<T>>

The lambda which configures the toolbar

Returns:

GridBuilder<T>

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

Example:
C#
@(Html.Kendo().Grid&lt;Product&gt;()
.Name("Grid")
.DataSource(dataSource =&gt;
// configure the data source
dataSource
.Ajax()
.Read(read =&gt; read.Action("Products_Read", "Home"))
)
.ToolBar(commands =&gt; commands.Create())
)

Sets the toolbar configuration of the grid. Supports adding custom or built-in commands, configuring the toolbar overflow settings and adaptive editing settings.

C#
public GridBuilder<T> ToolBar(Action<GridToolBarSettingsBuilder<T>> configurator)
Parameters:configuratorAction<GridToolBarSettingsBuilder<T>>

The lambda which configures the toolbar

Returns:

GridBuilder<T>

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

Example:
C#
@(Html.Kendo().Grid&lt;Product&gt;()
.Name("Grid")
.DataSource(dataSource =&gt;
// configure the data source
dataSource
.Ajax()
.Read(read =&gt; read.Action("Products_Read", "Home"))
)
.ToolBar(t=&gt;t
.Items(commands =&gt; {
commands.Create();
commands.Search();
})
.Mode(ToolBarOverflowMode.Scroll)
)
)

Sets toolbar template.

C#
public GridBuilder<T> ToolBar(IHtmlContent templateView)
Parameters:templateViewIHtmlContent

The view that contains the template.

Returns:

GridBuilder<T>

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

Sets toolbar template. When a String value is assigned to the toolbar configuration option, it will be treated as a single string template for the whole Grid toolbar and the string value will be passed as an argument to a kendo.template() function.

C#
public GridBuilder<T> ToolBar(string template)
Parameters:templatestring

The action defining the template.

Returns:

GridBuilder<T>

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

Example:
C#
@(Html.Kendo().Grid&lt;Product&gt;()
.Name("Grid")
.DataSource(dataSource =&gt;
// configure the data source
dataSource
.Ajax()
.Read(read =&gt; read.Action("Products_Read", "Home"))
)
.ToolBar("ToolBar content")
)

Sets the toolbar template. Use the Template Component to configure the Toolbar.

C#
public GridBuilder<T> ToolBar<TModel>(TemplateBuilder<TModel> template)
Parameters:templateTemplateBuilder<TModel>

The template component which contains the template.

Returns:

GridBuilder<T>

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

Example:
C#
@(Html.Kendo().Grid&lt;Product&gt;()
.Name("Grid")
.DataSource(dataSource =&gt;
// configure the data source
dataSource
.Ajax()
.Read(read =&gt; read.Action("Products_Read", "Home"))
)
.ToolBar(Html.Kendo().Template().AddComponent(c =&gt; c
.Button()
.Name("refresh")
.Icon("arrow-rotate-cw")
))
)

Sets the toolbar template. When a Function value is assigned (it may be a kendo.template() function call or a generic function reference), then the return value of the function will be used to render the Grid Toolbar contents.

C#
public GridBuilder<T> ToolBarClientTemplateHandler(string handler)
Parameters:handlerstring

The function handler which contains the template.

Returns:

GridBuilder<T>

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

Example:
C#
@(Html.Kendo().Grid&lt;Product&gt;()
.Name("Grid")
.DataSource(dataSource =&gt;
// configure the data source
dataSource
.Ajax()
.Read(read =&gt; read.Action("Products_Read", "Home"))
)
.ToolBar("toolbarTemplateHandler")
)

Sets the id of the script element which contains the client-side toolbar template of the grid.

C#
public GridBuilder<T> ToolBarClientTemplateId(string template)
Parameters:templatestringReturns:

GridBuilder<T>

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

Example:
C#
&lt;script id="toolbarTemplate" type="text/x-kendo-template"&gt;
&lt;span&gt;Toolbar content&lt;/span&gt;
&lt;/script&gt;

@(Html.Kendo().Grid&lt;Product&gt;()
.Name("Grid")
.DataSource(dataSource =&gt;
// configure the data source
dataSource
.Ajax()
.Read(read =&gt; read.Action("Products_Read", "Home"))
)
.ToolBar("toolbarTemplate")
)

Sets the width of the grid.

C#
public GridBuilder<T> Width(int pixelWidth)
Parameters:pixelWidthint

The width of the Grid

Returns:

GridBuilder<T>

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

Example:
C#
@(Html.Kendo().Grid&lt;OrderViewModel&gt;()
.Name("grid")
.Columns(columns =&gt;
{
columns.Bound(p =&gt; p.OrderID).Filterable(false);
columns.Bound(p =&gt; p.Freight);
})
.Width(300px)
.Scrollable()
.DataSource(dataSource =&gt; dataSource
.Ajax()
.PageSize(20)
.Read(read =&gt; read.Action("Orders_Read", "Grid"))
)
)

Sets the width of the grid.

C#
public GridBuilder<T> Width(string value)
Parameters:valuestring

The width of the Grid

Returns:

GridBuilder<T>

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

Example:
C#
@(Html.Kendo().Grid&lt;OrderViewModel&gt;()
.Name("grid")
.Columns(columns =&gt;
{
columns.Bound(p =&gt; p.OrderID).Filterable(false);
columns.Bound(p =&gt; p.Freight);
})
.Width("300px")
.Scrollable()
.DataSource(dataSource =&gt; dataSource
.Ajax()
.PageSize(20)
.Read(read =&gt; read.Action("Orders_Read", "Grid"))
)
)