GridToolBarCommandFactory
Methods
Create()
Defines a create command.
Example
@(Html.Kendo().Grid<OrderViewModel>()
.Name("grid")
.ToolBar(t => t.Create())
.Columns(columns =>
{
columns.Bound(p => p.OrderID).Filterable(false);
columns.Bound(p => p.Freight);
})
.Scrollable()
.DataSource(dataSource => dataSource
.Ajax()
.PageSize(20)
.Read(read => read.Action("Orders_Read", "Grid"))
)
)
Excel()
Represents a command which exports the current grid data to Excel.
Example
@(Html.Kendo().Grid<OrderViewModel>()
.Name("grid")
.ToolBar(t => t.Excel())
.Columns(columns =>
{
columns.Bound(p => p.OrderID).Filterable(false);
columns.Bound(p => p.Freight);
})
.Scrollable()
.DataSource(dataSource => dataSource
.Ajax()
.PageSize(20)
.Read(read => read.Action("Orders_Read", "Grid"))
)
)
Pdf()
Represents a command which exports the current grid data to PDF.
Example
@(Html.Kendo().Grid<OrderViewModel>()
.Name("grid")
.ToolBar(t => t.Pdf())
.Columns(columns =>
{
columns.Bound(p => p.OrderID).Filterable(false);
columns.Bound(p => p.Freight);
})
.Scrollable()
.DataSource(dataSource => dataSource
.Ajax()
.PageSize(20)
.Read(read => read.Action("Orders_Read", "Grid"))
)
)
Save()
Defines a save command.
Example
@(Html.Kendo().Grid<OrderViewModel>()
.Name("grid")
.ToolBar(t => t.Save())
.Columns(columns =>
{
columns.Bound(p => p.OrderID).Filterable(false);
columns.Bound(p => p.Freight);
})
.Scrollable()
.DataSource(dataSource => dataSource
.Ajax()
.PageSize(20)
.Read(read => read.Action("Orders_Read", "Grid"))
)
)
Custom()
Defines a custom command.
Example
@(Html.Kendo().Grid<OrderViewModel>()
.Name("grid")
.ToolBar(t => t.Custom())
.Columns(columns =>
{
columns.Bound(p => p.OrderID).Filterable(false);
columns.Bound(p => p.Freight);
})
.Scrollable()
.DataSource(dataSource => dataSource
.Ajax()
.PageSize(20)
.Read(read => read.Action("Orders_Read", "Grid"))
)
)
Search()
Defines a custom command.
Example
@(Html.Kendo().Grid<OrderViewModel>()
.Name("grid")
.ToolBar(t => t.Search())
.Columns(columns =>
{
columns.Bound(p => p.OrderID).Filterable(false);
columns.Bound(p => p.Freight);
})
.Scrollable()
.DataSource(dataSource => dataSource
.Ajax()
.PageSize(20)
.Read(read => read.Action("Orders_Read", "Grid"))
)
)
Columns()
Adds a global columns command to the ToolBar.
Example
@(Html.Kendo().Grid<OrderViewModel>()
.Name("grid")
.ToolBar(t => t.Columns())
.Columns(columns =>
{
columns.Bound(p => p.OrderID).Filterable(false);
columns.Bound(p => p.Freight);
})
.Scrollable()
.DataSource(dataSource => dataSource
.Ajax()
.PageSize(20)
.Read(read => read.Action("Orders_Read", "Grid"))
)
)
Template(System.Action)
Sets toolbar template.
Parameters
template - System.Action
The action defining the template.
Template(System.String)
Sets toolbar template.
Parameters
template - System.String
The string template
Example
@(Html.Kendo().Grid<OrderViewModel>()
.Name("grid")
.ToolBar(t => t.Template("ToolbarTemplate"))
.Columns(columns =>
{
columns.Bound(p => p.OrderID).Filterable(false);
columns.Bound(p => p.Freight);
})
.Scrollable()
.DataSource(dataSource => dataSource
.Ajax()
.PageSize(20)
.Read(read => read.Action("Orders_Read", "Grid"))
)
)
Template(System.Action)
Sets toolbar template.
Parameters
template - System.Action<Grid>
The action defining the template.
Template(System.Func)
Parameters
template - System.Func<Grid,Object>
ClientTemplateHandler(System.String)
Parameters
template - System.String
ClientTemplate(Kendo.Mvc.UI.TemplateBuilder)
Parameters
template - TemplateBuilder<TModel>
Separator()
Adds a separator to the ToolBar.
Spacer()
Adds a spacer to the ToolBar.
Paste()
Adds a DropDownList to the ToolBar that allows the user to customize the pasting behavior.
Example
@(Html.Kendo().Grid<OrderViewModel>()
.Name("grid")
.Selectable()
.AllowPaste()
.ToolBar(t => t.Paste())
.Columns(columns =>
{
columns.Bound(p => p.OrderID).Filterable(false);
columns.Bound(p => p.Freight);
})
.Scrollable()
.DataSource(dataSource => dataSource
.Ajax()
.PageSize(20)
.Read(read => read.Action("Orders_Read", "Grid"))
)
)