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

Defines the fluent interface for configuring toolbar commands.

Definition

Namespace:Kendo.Mvc.UI.Fluent

Assembly:Kendo.Mvc.dll

Type Parameters:

T

The type of the model

Syntax:

C#
public class GridToolBarCommandFactoryBase<T> where T : class

Inheritance: objectGridToolBarCommandFactoryBase<T>

Derived Classes: GridToolBarCommandFactory<T>

Inherited Members object.GetType()object.MemberwiseClone()object.ToString()object.Equals(object)object.Equals(object, object)object.ReferenceEquals(object, object)object.GetHashCode()...

Constructors

C#
public GridToolBarCommandFactoryBase(GridToolBarSettings<T> settings, GridMessagesCommandsSettings messagesSettings)
Parameters:settingsGridToolBarSettings<T>messagesSettingsGridMessagesCommandsSettings

Methods

Adds a command that triggers the edit state of currently selected item. To work as expected, the grid should have the Selectable configuration enabled. If multiple selection is enabled, the item which will be edited is the last selected one.

C#
public GridToolBarCommandBuilder<T> AIAssistant()
Returns:

GridToolBarCommandBuilder<T>

Returns a GridToolBarCommandBuilder instance for further configuration of the command.

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

Adds a command that cancels the changes to the dataItem that is being currenly edited.

C#
public GridToolBarCommandBuilder<T> CancelEdit()
Returns:

GridToolBarCommandBuilder<T>

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

Adds a command that enables the user to change the visibillity of the Grid's columns.

C#
public GridToolBarCommandBuilder<T> ColumnChooser()
Returns:

GridToolBarCommandBuilder<T>

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

Adds a global columns command to the ToolBar.

C#
public GridToolBarCommandBuilder<T> Columns()
Returns:

GridToolBarCommandBuilder<T>

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

Defines a create command.

C#
public GridToolBarCommandBuilder<T> Create()
Returns:

GridToolBarCommandBuilder<T>

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

Defines a custom command.

C#
public GridToolBarCustomCommandBuilder<T> Custom()
Returns:

GridToolBarCustomCommandBuilder<T>

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

Adds a command that removes the selected item. To work as expected, the grid should be have the Selectable configuration enabled. If multiple selection is enabled, the item which will be remoed is the last selected one.

C#
public GridToolBarCommandBuilder<T> Destroy()
Returns:

GridToolBarCommandBuilder<T>

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

Adds a command that triggers the edit state of currently selected item. To work as expected, the grid should have the Selectable configuration enabled. If multiple selection is enabled, the item which will be edited is the last selected one.

C#
public GridToolBarCommandBuilder<T> Edit()
Returns:

GridToolBarCommandBuilder<T>

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

Represents a command which exports the current grid data to Excel.

C#
public GridToolBarCommandBuilder<T> Excel()
Returns:

GridToolBarCommandBuilder<T>

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

Adds a command that enables the user to use the filtering functionallity of the Grid.

C#
public GridToolBarFilterCommandBuilder<T> Filter()
Returns:

GridToolBarFilterCommandBuilder<T>

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

Adds a command that enables the user to use the grouping functionallity of the Grid.

C#
public GridToolBarGroupCommandBuilder<T> Group()
Returns:

GridToolBarGroupCommandBuilder<T>

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

Adds a DropDownList to the ToolBar that allows the user to customize the pasting behavior.

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

Represents a command which exports the current grid data to PDF.

C#
public GridToolBarCommandBuilder<T> Pdf()
Returns:

GridToolBarCommandBuilder<T>

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

Defines a save command.

C#
public GridToolBarSaveCommandBuilder<T> Save()
Returns:

GridToolBarSaveCommandBuilder<T>

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

Defines a custom command.

C#
public GridToolBarSearchCommandBuilder<T> Search()
Returns:

GridToolBarSearchCommandBuilder<T>

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

Adds a checkbox to the ToolBar that allows the user to select all items. Requires enabled checkbox selection and multiple row selection

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

Adds a separator to the ToolBar.

C#
public void Separator()

Adds a SmartBox command to the Grid ToolBar. The SmartBox provides search, semantic search, and AI assistant capabilities.

C#
public void SmartBox()
Example:
C#
@(Html.Kendo().Grid&lt;OrderViewModel&gt;()
.Name("grid")
.ToolBar(t =&gt; t.SmartBox())
.SmartBox(smartBox =&gt; smartBox
.Placeholder("Search...")
.SearchSettings(search =&gt; search.Enabled(true))
)
.Columns(columns =&gt;
{
columns.Bound(p =&gt; p.OrderID).Filterable(false);
columns.Bound(p =&gt; p.Freight);
})
.DataSource(dataSource =&gt; dataSource
.Ajax()
.PageSize(20)
.Read(read =&gt; read.Action("Orders_Read", "Grid"))
)
)

Adds a command that enables the user to use the sorting functionallity of the Grid.

C#
public GridToolBarSortCommandBuilder<T> Sort()
Returns:

GridToolBarSortCommandBuilder<T>

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

Adds a spacer to the ToolBar.

C#
public void Spacer()

Adds a command that saves the changes to the dataItem that is being currenly edited. Applicable when using InLine Editing.

C#
public GridToolBarCommandBuilder<T> Update()
Returns:

GridToolBarCommandBuilder<T>

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