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

Defines the fluent API for configuring the ToolBarItem settings.

Definition

Namespace:Kendo.Mvc.UI.Fluent

Assembly:Kendo.Mvc.dll

Syntax:

C#
public class ToolBarItemBuilder

Inheritance: objectToolBarItemBuilder

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

Constructors

C#
public ToolBarItemBuilder(ToolBarItem settings)
Parameters:settingsToolBarItem

Methods

Specifies the buttons of ButtonGroup.

C#
public ToolBarItemBuilder Buttons(Action<ToolBarItemButtonFactory> configurator)
Parameters:configuratorAction<ToolBarItemButtonFactory>

The action that configures the buttons.

Returns:

ToolBarItemBuilder

Specifies the click event handler of the button. Applicable only for commands of type button and splitButton.

C#
public ToolBarItemBuilder Click(Func<object, object> handler)
Parameters:handlerFunc<object, object>

The value that configures the click action.

Returns:

ToolBarItemBuilder

Example:
C#
@(Html.Kendo().ToolBar()
.Name("toolBar")
.Items(items =&gt;
{
items.Add().Click(@&lt;text&gt;
function(e) {
// Handle the Click event inline.
}
&lt;/text&gt;);
})
)

Specifies the click event handler of the button. Applicable only for commands of type button and splitButton.

C#
public ToolBarItemBuilder Click(string handler)
Parameters:handlerstring

The value that configures the click action.

Returns:

ToolBarItemBuilder

Example:
C#
@(Html.Kendo().ToolBar()
.Name("toolBar")
.Items(items =&gt;
{
items.Add().Click("onClick");
})
)

Specifies whether the control is initially enabled or disabled. Default value is "true".

C#
public ToolBarItemBuilder Enable(bool value)
Parameters:valuebool

The value that configures the enable.

Returns:

ToolBarItemBuilder

Example:
C#
@(Html.Kendo().ToolBar()
.Name("toolBar")
.Items(items =&gt;
{
items.Add().Enable(false);
})
)

Assigns the button to a group. Applicable only for buttons with togglable: true.

C#
public ToolBarItemBuilder Group(string value)
Parameters:valuestring

The value that configures the group.

Returns:

ToolBarItemBuilder

Example:
C#
@(Html.Kendo().ToolBar()
.Name("toolBar")
.Items(items =&gt;
{
items.Add().Group("groupName");
})
)

Determines if a button is visible or hidden. By default buttons are visible.

C#
public ToolBarItemBuilder Hidden(bool value)
Parameters:valuebool

The value that configures the hidden.

Returns:

ToolBarItemBuilder

Example:
C#
@(Html.Kendo().ToolBar()
.Name("toolBar")
.Items(items =&gt;
{
items.Add().Hidden(true);
})
)
C#
public ToolBarItemBuilder HtmlAttributes(IDictionary<string, object> value)
Parameters:valueIDictionary<string, object>Returns:

ToolBarItemBuilder

Specifies the HTML attributes of a ToolBar button.

C#
public ToolBarItemBuilder HtmlAttributes(object value)
Parameters:valueobject

The value that configures the htmlattributes.

Returns:

ToolBarItemBuilder

Example:
C#
@(Html.Kendo().ToolBar()
.Name("toolBar")
.Items(items =&gt;
{
items.Add().Type(CommandType.Button).Text("Button").HtmlAttributes(new {@class="myClass"});
})
)

Sets icon for the item. The icon should be one of the existing in the Kendo UI theme sprite.

C#
public ToolBarItemBuilder Icon(string value)
Parameters:valuestring

The value that configures the icon.

Returns:

ToolBarItemBuilder

Example:
C#
@(Html.Kendo().ToolBar()
.Name("toolBar")
.Items(items =&gt;
{
items.Add().Icon("gear");
})
)

Specifies the ID of the button.

C#
public ToolBarItemBuilder Id(string value)
Parameters:valuestring

The value that configures the id.

Returns:

ToolBarItemBuilder

Example:
C#
@(Html.Kendo().ToolBar()
.Name("toolBar")
.Items(items =&gt;
{
items.Add().Id("itemId");
})
)

If set, the ToolBar will render an image with the specified URL in the button.

C#
public ToolBarItemBuilder ImageUrl(string value)
Parameters:valuestring

The value that configures the imageurl.

Returns:

ToolBarItemBuilder

Example:
C#
@(Html.Kendo().ToolBar()
.Name("toolBar")
.Items(items =&gt;
{
items.Add().ImageUrl("imageUrl");
})
)

Specifies the menu buttons of a SplitButton or a DropDownButton.

C#
public ToolBarItemBuilder MenuButtons(Action<ToolBarItemMenuButtonFactory> configurator)
Parameters:configuratorAction<ToolBarItemMenuButtonFactory>

The action that configures the menubuttons.

Returns:

ToolBarItemBuilder

Specifies how the button behaves when the ToolBar is resized.

C#
public ToolBarItemBuilder Overflow(ShowInOverflowPopup value)
Parameters:valueShowInOverflowPopup

The value that configures the overflow.

Returns:

ToolBarItemBuilder

Example:
C#
@(Html.Kendo().ToolBar()
.Name("toolBar")
.Items(items =&gt;
{
items.Add().Overflow(ShowInOverflowPopup.Auto);
})
)

Specifies what element will be added in the command overflow popup. Applicable only for items that have a template.

C#
public ToolBarItemBuilder OverflowTemplate(string value)
Parameters:valuestring

The value that configures the overflowtemplate.

Returns:

ToolBarItemBuilder

Example:
C#
@(Html.Kendo().ToolBar()
.Name("toolBar")
.Items(items =&gt;
{
items.Add().OverflowTemplate("&lt;span&gt;Overflow template&lt;/span&gt;");
})
)

Specifies what element will be added in the command overflow popup. Applicable only for items that have a template.

C#
public ToolBarItemBuilder OverflowTemplate<TModel>(TemplateBuilder<TModel> template)
Parameters:templateTemplateBuilder<TModel>

A Template component that configures the overflowtemplate.

Returns:

ToolBarItemBuilder

Specifies what element will be added in the command overflow popup. Applicable only for items that have a template.

C#
public ToolBarItemBuilder OverflowTemplateHandler(string value)
Parameters:valuestring

The value that configures the overflowtemplate.

Returns:

ToolBarItemBuilder

Example:
C#
@(Html.Kendo().ToolBar()
.Name("toolBar")
.Items(items =&gt;
{
items.Add().OverflowTemplateHandler("handler");
})
)

Specifies what element will be added in the command overflow popup. Applicable only for items that have a template.

C#
public ToolBarItemBuilder OverflowTemplateId(string value)
Parameters:valuestring

The value that configures the overflowtemplate.

Returns:

ToolBarItemBuilder

Example:
C#
@(Html.Kendo().ToolBar()
.Name("toolBar")
.Items(items =&gt;
{
items.Add().OverflowTemplateId("overflowTemplateId");
})
)

Specifies what element will be added in the command overflow popup. Applicable only for items that have a template.

C#
public ToolBarItemBuilder OverflowTemplateView(MvcHtmlString value)
Parameters:valueMvcHtmlString

The value that configures the overflowtemplate.

Returns:

ToolBarItemBuilder

Example:
C#
@(Html.Kendo().ToolBar()
.Name("toolBar")
.Items(items =&gt;
{
items.Add().OverflowTemplateView(Html.Partial("YourPartialViewName"));
})
)

Specifies whether the button is primary. Primary buttons receive different styling.

C#
public ToolBarItemBuilder Primary(bool value)
Parameters:valuebool

The value that configures the primary.

Returns:

ToolBarItemBuilder

Example:
C#
@(Html.Kendo().ToolBar()
.Name("toolBar")
.Items(items =&gt;
{
items.Add().Primary(true);
})
)

Specifies if the toggle button is initially selected. Applicable only for buttons with togglable: true.

C#
public ToolBarItemBuilder Selected(bool value)
Parameters:valuebool

The value that configures the selected.

Returns:

ToolBarItemBuilder

Example:
C#
@(Html.Kendo().ToolBar()
.Name("toolBar")
.Items(items =&gt;
{
items.Add().Selected(true);
})
)

Specifies where the icon will be displayed.

C#
public ToolBarItemBuilder ShowIcon(ShowIn value)
Parameters:valueShowIn

The value that configures the showicon.

Returns:

ToolBarItemBuilder

Example:
C#
@(Html.Kendo().ToolBar()
.Name("toolBar")
.Items(items =&gt;
{
items.Add().ShowIcon(ShowIn.Overflow);
})
)

Specifies where the text will be displayed.

C#
public ToolBarItemBuilder ShowText(ShowIn value)
Parameters:valueShowIn

The value that configures the showtext.

Returns:

ToolBarItemBuilder

Example:
C#
@(Html.Kendo().ToolBar()
.Name("toolBar")
.Items(items =&gt;
{
items.Add().ShowText(ShowIn.Overflow);
})
)

Defines a CSS class (or multiple classes separated by spaces) which will be used for button icon.

C#
public ToolBarItemBuilder SpriteCssClass(string value)
Parameters:valuestring

The value that configures the spritecssclass.

Returns:

ToolBarItemBuilder

Example:
C#
@(Html.Kendo().ToolBar()
.Name("toolBar")
.Items(items =&gt;
{
items.Add().SpriteCssClass("k-icon k-font-icon k-i-refresh");
})
)

Specifies what element will be added in the ToolBar wrapper. Items with template does not have a type.

C#
public ToolBarItemBuilder Template(string value)
Parameters:valuestring

The value that configures the template.

Returns:

ToolBarItemBuilder

Example:
C#
@(Html.Kendo().ToolBar()
.Name("toolBar")
.Items(items =&gt;
{
items.Add().Template("template");
})
)

Specifies what element will be added in the ToolBar wrapper. Items with template does not have a type.

C#
public ToolBarItemBuilder Template<TModel>(TemplateBuilder<TModel> template)
Parameters:templateTemplateBuilder<TModel>

A Template component that configures the template.

Returns:

ToolBarItemBuilder

Specifies what element will be added in the ToolBar wrapper. Items with template does not have a type.

C#
public ToolBarItemBuilder TemplateHandler(string value)
Parameters:valuestring

The value that configures the template.

Returns:

ToolBarItemBuilder

Example:
C#
@(Html.Kendo().ToolBar()
.Name("toolBar")
.Items(items =&gt;
{
items.Add().TemplateHandler("handler");
})
)

Specifies what element will be added in the ToolBar wrapper. Items with template does not have a type.

C#
public ToolBarItemBuilder TemplateId(string value)
Parameters:valuestring

The value that configures the template.

Returns:

ToolBarItemBuilder

Example:
C#
@(Html.Kendo().ToolBar()
.Name("toolBar")
.Items(items =&gt;
{
items.Add().TemplateId("templateId");
})
)

Specifies what element will be added in the ToolBar wrapper. Items with template does not have a type.

C#
public ToolBarItemBuilder TemplateView(MvcHtmlString value)
Parameters:valueMvcHtmlString

The value that configures the template.

Returns:

ToolBarItemBuilder

Example:
C#
@(Html.Kendo().ToolBar()
.Name("toolBar")
.Items(items =&gt;
{
items.Add().TemplateView(Html.Partial("YourPartialViewName"));
})
)

Sets the text of the button.

C#
public ToolBarItemBuilder Text(string value)
Parameters:valuestring

The value that configures the text.

Returns:

ToolBarItemBuilder

Example:
C#
@(Html.Kendo().ToolBar()
.Name("toolBar")
.Items(items =&gt;
{
items.Add().Text("itemText");
})
)

Specifies if the button is togglable, e.g. has a selected and unselected state.

C#
public ToolBarItemBuilder Togglable(bool value)
Parameters:valuebool

The value that configures the togglable.

Returns:

ToolBarItemBuilder

Example:
C#
@(Html.Kendo().ToolBar()
.Name("toolBar")
.Items(items =&gt;
{
items.Add().Type(CommandType.Button).Togglable(true);
})
)

Specifies the toggle event handler of the button. Applicable only for commands of type button and togglable: true.

C#
public ToolBarItemBuilder Toggle(Func<object, object> handler)
Parameters:handlerFunc<object, object>

The value that configures the toggle action.

Returns:

ToolBarItemBuilder

Example:
C#
@(Html.Kendo().ToolBar()
.Name("toolBar")
.Items(items =&gt;
{
items.Add().Type(CommandType.Button).Togglable(true).Toggle(@
function(e) {
console.log("Button toggled", e);
}
);
})
)

Specifies the toggle event handler of the button. Applicable only for commands of type button and togglable: true.

C#
public ToolBarItemBuilder Toggle(string handler)
Parameters:handlerstring

The value that configures the toggle action.

Returns:

ToolBarItemBuilder

Example:
C#
@(Html.Kendo().ToolBar()
.Name("toolBar")
.Items(items =&gt;
{
items.Add().Type(CommandType.Button).Togglable(true).Toggle("handler");
})
)

Specifies the type of the item.

C#
public ToolBarItemBuilder Type(CommandType value)
Parameters:valueCommandType

The value that configures the type.

Returns:

ToolBarItemBuilder

Example:
C#
@(Html.Kendo().ToolBar()
.Name("toolBar")
.Items(items =&gt;
{
items.Add().Type(CommandType.Button);
})
)

Specifies the url to navigate to.

C#
public ToolBarItemBuilder Url(string value)
Parameters:valuestring

The value that configures the url.

Returns:

ToolBarItemBuilder

Example:
C#
@(Html.Kendo().ToolBar()
.Name("toolBar")
.Items(items =&gt;
{
items.Add().Url("url");
})
)