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

Defines the fluent interface for configuring toolbar custom command.

Definition

Constructors

C#
public GridToolBarCustomCommandBuilder(GridToolBarCustomCommand<T> command)
Parameters:commandGridToolBarCustomCommand<T>

Methods

Sets command action.

C#
public GridToolBarCustomCommandBuilder<T> Action(RouteValueDictionary routeValues)
Parameters:routeValuesRouteValueDictionary

The route values

Returns:

GridToolBarCustomCommandBuilder<T>

Example:
C#
@(Html.Kendo().Grid&lt;User&gt;()
.Name("grid")
.ToolBar(toolbar =&gt;
{
toolbar.Custom().Name("CustomCommand").Action(new RouteValueDictionary { { "controller", "Home" }, { "action", "CustomCommand"} })
})
)

Sets command action and controller.

C#
public GridToolBarCustomCommandBuilder<T> Action(string actionName, string controllerName, object routeValues)
Parameters:actionNamestring

The action name

controllerNamestring

The controller name

routeValuesobject

The route values

Returns:

GridToolBarCustomCommandBuilder<T>

Example:
C#
@(Html.Kendo().Grid&lt;User&gt;()
.Name("grid")
.ToolBar(toolbar =&gt;
{
toolbar.Custom().Name("CustomCommand").Action("CustomCommand", "Home", new {id = 1});
})
)

Sets command action and controller.

C#
public GridToolBarCustomCommandBuilder<T> Action(string actionName, string controllerName, RouteValueDictionary routeValues)
Parameters:actionNamestring

The action name

controllerNamestring

The controller name

routeValuesRouteValueDictionary

The route values

Returns:

GridToolBarCustomCommandBuilder<T>

Example:
C#
@(Html.Kendo().Grid&lt;User&gt;()
.Name("grid")
.ToolBar(toolbar =&gt;
{
toolbar.Custom().Name("CustomCommand").Action("Some", "Some", new RouteValueDictionary { { "id", 1 } });
})
)

Sets command action and controller.

C#
public GridToolBarCustomCommandBuilder<T> Action(string actionName, string controllerName)
Parameters:actionNamestring

The action name

controllerNamestring

The controller name

Returns:

GridToolBarCustomCommandBuilder<T>

Example:
C#
@(Html.Kendo().Grid&lt;User&gt;()
.Name("grid")
.ToolBar(toolbar =&gt;
{
toolbar.Custom().Name("CustomCommand").Action("CustomCommand", "Home");
})
)

Sets command action.

C#
public GridToolBarCustomCommandBuilder<T> Action<TController>(Expression<Action<TController>> controllerAction) where TController : Controller
Parameters:controllerActionExpression<Action<TController>>Returns:

GridToolBarCustomCommandBuilder<T>

Exceptions: ArgumentException

Sets the toolbar command template.

C#
public GridToolBarCustomCommandBuilder<T> ClientTemplate(string template)
Parameters:templatestring

The action defining the template.

Returns:

GridToolBarCustomCommandBuilder<T>

Example:
C#
@(Html.Kendo().Grid&lt;User&gt;()
.Name("grid")
.ToolBar(toolbar =&gt;
{
toolbar.Custom().Name("CustomCommand").ClientTemplate("Custom Command");
})
)

Sets the toolbar command template.

C#
public GridToolBarCustomCommandBuilder<T> ClientTemplate<TModel>(TemplateBuilder<TModel> template)
Parameters:templateTemplateBuilder<TModel>

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

Returns:

GridToolBarCustomCommandBuilder<T>

Example:
C#
@(Html.Kendo().Grid&lt;User&gt;()
.Name("grid")
.ToolBar(toolbar =&gt;
{
toolbar.Custom().Name("CustomCommand").ClientTemplate(Html.Kendo()
.Template()
.AddHtml("Some Template")
);
})
)

Sets the toolbar command template.

C#
public GridToolBarCustomCommandBuilder<T> ClientTemplateHandler(string handler)
Parameters:handlerstring

The handler defining the template.

Returns:

GridToolBarCustomCommandBuilder<T>

Example:
C#
@(Html.Kendo().Grid&lt;User&gt;()
.Name("grid")
.ToolBar(toolbar =&gt;
{
toolbar.Custom().Name("CustomCommand").ClientTemplateHandler("myHandler");
})
)

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

C#
public GridToolBarCustomCommandBuilder<T> ClientTemplateId(string template)
Parameters:templatestring

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

Returns:

GridToolBarCustomCommandBuilder<T>

Example:
C#
@(Html.Kendo().Grid&lt;User&gt;()
.Name("grid")
.ToolBar(toolbar =&gt;
{
toolbar.Custom().Name("CustomCommand").ClientTemplateId("customCommandTemplate");
})
)

Sets the toolbar command template.

C#
public GridToolBarCustomCommandBuilder<T> ClientTemplateView(IHtmlString value)
Parameters:valueIHtmlString

The partial view that will define the template.

Returns:

GridToolBarCustomCommandBuilder<T>

Example:
C#
@(Html.Kendo().Grid&lt;User&gt;()
.Name("grid")
.ToolBar(toolbar =&gt;
{
toolbar.Custom().Name("CustomCommand").ClientTemplateView(Html.Partial("_CustomCommand"));
})
)

Sets the command name.

C#
public GridToolBarCustomCommandBuilder<T> Name(string name)
Parameters:namestring

The name of the command

Returns:

GridToolBarCustomCommandBuilder<T>

Example:
C#
@(Html.Kendo().Grid&lt;User&gt;()
.Name("grid")
.ToolBar(toolbar =&gt;
{
toolbar.Custom().Name("CustomCommand");
})
)

Sets command route and route values.

C#
public GridToolBarCustomCommandBuilder<T> Route(string routeName, object routeValues)
Parameters:routeNamestring

The route name

routeValuesobject

The route values

Returns:

GridToolBarCustomCommandBuilder<T>

Example:
C#
@(Html.Kendo().Grid&lt;User&gt;()
.Name("grid")
.ToolBar(toolbar =&gt;
{
toolbar.Custom().Name("CustomCommand").Route("Default", new { id = 1 })
})
)

Sets command route and route values.

C#
public GridToolBarCustomCommandBuilder<T> Route(string routeName, RouteValueDictionary routeValues)
Parameters:routeNamestring

The route name

routeValuesRouteValueDictionary

The route values

Returns:

GridToolBarCustomCommandBuilder<T>

Example:
C#
@(Html.Kendo().Grid&lt;User&gt;()
.Name("grid")
.ToolBar(toolbar =&gt;
{
toolbar.Custom().Name("CustomCommand").Route("Default", new RouteValueDictionary { { "id", 1 } })
})
)

Sets command route.

C#
public GridToolBarCustomCommandBuilder<T> Route(string routeName)
Parameters:routeNamestring

The route name

Returns:

GridToolBarCustomCommandBuilder<T>

Example:
C#
@(Html.Kendo().Grid&lt;User&gt;()
.Name("grid")
.ToolBar(toolbar =&gt;
{
toolbar.Custom().Name("CustomCommand").Route("Default")
})
)

Sets command absolute URL.

C#
public GridToolBarCustomCommandBuilder<T> Url(string value)
Parameters:valuestring

The URL

Returns:

GridToolBarCustomCommandBuilder<T>

Example:
C#
@(Html.Kendo().Grid&lt;User&gt;()
.Name("grid")
.ToolBar(toolbar =&gt;
{
toolbar.Custom().Name("CustomCommand").Url("/Home/CustomCommand");
})
)