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

GridToolBarCustomCommandBuilder

Methods

Route(System.String)

Sets command route.

Parameters

routeName - System.String

The route name

Example


                @(Html.Kendo().Grid<User>()
                       .Name("grid")
                       .ToolBar(toolbar =>
                       {
                          toolbar.Custom().Name("CustomCommand").Route("Default")   
                       })
                )

Route(System.String,System.Object)

Sets command route and route values.

Parameters

routeName - System.String

The route name

routeValues - System.Object

The route values

Example


                @(Html.Kendo().Grid<User>()
                       .Name("grid")
                       .ToolBar(toolbar =>
                       {
                          toolbar.Custom().Name("CustomCommand").Route("Default", new { id = 1 })   
                       })
                )

Route(System.String,System.Web.Routing.RouteValueDictionary)

Sets command route and route values.

Parameters

routeName - System.String

The route name

routeValues - System.Web.Routing.RouteValueDictionary

The route values

Example


                @(Html.Kendo().Grid<User>()
                       .Name("grid")
                       .ToolBar(toolbar =>
                       {
                          toolbar.Custom().Name("CustomCommand").Route("Default", new RouteValueDictionary { { "id", 1 } })   
                       })
                )

Action(System.Linq.Expressions.Expression)

Parameters

controllerAction - System.Linq.Expressions.Expression<Action>

Action(System.Web.Routing.RouteValueDictionary)

Sets command action.

Parameters

routeValues - System.Web.Routing.RouteValueDictionary

The route values

Example


                @(Html.Kendo().Grid<User>()
                       .Name("grid")
                       .ToolBar(toolbar =>
                       {
                          toolbar.Custom().Name("CustomCommand").Action(new RouteValueDictionary { { "controller", "Home" }, { "action", "CustomCommand"} })   
                       })
                )

Action(System.String,System.String)

Sets command action and controller.

Parameters

actionName - System.String

The action name

controllerName - System.String

The controller name

Example


                @(Html.Kendo().Grid<User>()
                       .Name("grid")
                       .ToolBar(toolbar =>
                       {
                          toolbar.Custom().Name("CustomCommand").Action("CustomCommand", "Home");   
                       })
                )

Action(System.String,System.String,System.Object)

Sets command action and controller.

Parameters

actionName - System.String

The action name

controllerName - System.String

The controller name

routeValues - System.Object

The route values

Example


                @(Html.Kendo().Grid<User>()
                       .Name("grid")
                       .ToolBar(toolbar =>
                       {
                          toolbar.Custom().Name("CustomCommand").Action("CustomCommand", "Home", new {id = 1});   
                       })
                )

Action(System.String,System.String,System.Web.Routing.RouteValueDictionary)

Sets command action and controller.

Parameters

actionName - System.String

The action name

controllerName - System.String

The controller name

routeValues - System.Web.Routing.RouteValueDictionary

The route values

Example


                @(Html.Kendo().Grid<User>()
                       .Name("grid")
                       .ToolBar(toolbar =>
                       {
                          toolbar.Custom().Name("CustomCommand").Action("Some", "Some", new RouteValueDictionary { { "id", 1 } });   
                       })
                )

Url(System.String)

Sets command absolute URL.

Parameters

value - System.String

The URL

Example


                @(Html.Kendo().Grid<User>()
                       .Name("grid")
                       .ToolBar(toolbar =>
                       {
                          toolbar.Custom().Name("CustomCommand").Url("/Home/CustomCommand");   
                       })
                )

Name(System.String)

Sets the command name.

Parameters

name - System.String

The name of the command

Example


                @(Html.Kendo().Grid<User>()
                       .Name("grid")
                       .ToolBar(toolbar =>
                       {
                          toolbar.Custom().Name("CustomCommand");   
                       })
                )

ClientTemplate(Kendo.Mvc.UI.TemplateBuilder)

Sets the toolbar command template.

Parameters

template - TemplateBuilder<TModel>

The template component that will be set for the command template.

Example


                @(Html.Kendo().Grid<User>()
                       .Name("grid")
                       .ToolBar(toolbar =>
                       {
                          toolbar.Custom().Name("CustomCommand").ClientTemplate(Html.Kendo()
                                                                         .Template()
                                                                         .AddHtml("Some Template")              
                                                                );   
                       })
                )

ClientTemplateHandler(System.String)

Sets the toolbar command template.

Parameters

handler - System.String

The handler defining the template.

Example


                @(Html.Kendo().Grid<User>()
                       .Name("grid")
                       .ToolBar(toolbar =>
                       {
                          toolbar.Custom().Name("CustomCommand").ClientTemplateHandler("myHandler");   
                       })
                )

ClientTemplateView(System.Web.IHtmlString)

Sets the toolbar command template.

Parameters

value - System.Web.IHtmlString

The partial view that will define the template.

Example


                @(Html.Kendo().Grid<User>()
                       .Name("grid")
                       .ToolBar(toolbar =>
                       {
                          toolbar.Custom().Name("CustomCommand").ClientTemplateView(Html.Partial("_CustomCommand"));   
                       })
                )

ClientTemplate(System.String)

Sets the toolbar command template.

Parameters

template - System.String

The action defining the template.

Example


                @(Html.Kendo().Grid<User>()
                       .Name("grid")
                       .ToolBar(toolbar =>
                       {
                          toolbar.Custom().Name("CustomCommand").ClientTemplate("Custom Command");   
                       })
                )

ClientTemplateId(System.String)

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

Parameters

template - System.String

The ID of script that will be rendered for the toolbar command template.

Example


                @(Html.Kendo().Grid<User>()
                       .Name("grid")
                       .ToolBar(toolbar =>
                       {
                          toolbar.Custom().Name("CustomCommand").ClientTemplateId("customCommandTemplate");   
                       })
                )

Text(System.String)

Sets the text displayed in the button.

Parameters

text - System.String

The text which should be displayed

IconClass(System.String)

The class for the web font icon of the button.

Parameters

iconClass - System.String

The class for the web font icon of the button

HtmlAttributes(System.Object)

Sets the HTML attributes.

Parameters

attributes - System.Object

The HTML attributes.

HtmlAttributes(System.Collections.Generic.IDictionary)

Sets the HTML attributes.

Parameters

attributes - System.Collections.Generic.IDictionary<String,Object>

The HTML attributes.

In this article
Not finding the help you need?