New to Telerik UI for ASP.NET Core? 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

GridToolBarCommandFactoryBase method.

C#
public GridToolBarCommandFactoryBase(GridToolBarSettings settings, Grid<T> grid)
Parameters:settingsGridToolBarSettingsgridGrid<T>

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 AIAssistant()
Returns:

GridToolBarCommandBuilder

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 CancelEdit()
Returns:

GridToolBarCommandBuilder

Returns a GridToolBarCommandBuilder instance for further configuration of the command.

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 ColumnChooser()
Returns:

GridToolBarCommandBuilder

Returns a GridToolBarCommandBuilder instance for further configuration of the command.

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 column menu to the ToolBar.

C#
public GridToolBarCommandBuilder Columns()
Returns:

GridToolBarCommandBuilder

Returns a GridToolBarCommandBuilder instance for further configuration of the command.

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()
.ColumnMenu()
.DataSource(dataSource =&gt; dataSource
.Ajax()
.PageSize(20)
.Read(read =&gt; read.Action("Orders_Read", "Grid"))
)
)

Defines a create command.

C#
public GridToolBarCommandBuilder Create()
Returns:

GridToolBarCommandBuilder

Returns a GridToolBarCommandBuilder instance for further configuration of the command.

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 Custom()
Returns:

GridToolBarCustomCommandBuilder

Returns a GridToolBarCustomCommandBuilder instance for further configuration of the command.

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 Destroy()
Returns:

GridToolBarCommandBuilder

Returns a GridToolBarCommandBuilder instance for further configuration of the command.

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 Edit()
Returns:

GridToolBarCommandBuilder

Returns a GridToolBarCommandBuilder instance for further configuration of the command.

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 Excel()
Returns:

GridToolBarCommandBuilder

Returns a GridToolBarCommandBuilder instance for further configuration of the command.

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 Filter()
Returns:

GridToolBarFilterCommandBuilder

Returns a GridToolBarFilterCommandBuilder instance for further configuration of the command.

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 Group()
Returns:

GridToolBarGroupCommandBuilder

Returns a GridToolBarGroupCommandBuilder instance for further configuration of the command.

Example:
C#
@(Html.Kendo().Grid&lt;OrderViewModel&gt;()
.Name("grid")
.ToolBar(t =&gt; t.Group())
.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 Pdf()
Returns:

GridToolBarCommandBuilder

Returns a GridToolBarCommandBuilder instance for further configuration of the command.

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 Save()
Returns:

GridToolBarSaveCommandBuilder

Returns a GridToolBarSaveCommandBuilder instance for further configuration of the command.

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 Search()
Returns:

GridToolBarSearchCommandBuilder

Returns a GridToolBarSearchCommandBuilder instance for further configuration of the command.

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 Sort()
Returns:

GridToolBarSortCommandBuilder

Returns a GridToolBarSortCommandBuilder instance for further configuration of the command.

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 Update()
Returns:

GridToolBarCommandBuilder

Returns a GridToolBarCommandBuilder instance for further configuration of the command.

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