ToolBarItemBuilder
Methods
HtmlAttributes(System.Object)
Specifies the HTML attributes of a ToolBar button.
Parameters
value - System.Object
The value that configures the htmlattributes.
Example
@(Html.Kendo().ToolBar()
.Name("toolBar")
.Items(items =>
{
items.Add().Type(CommandType.Button).Text("Button").HtmlAttributes(new {@class="myClass"});
})
)
HtmlAttributes(System.Collections.Generic.IDictionary)
Parameters
value - System.Collections.Generic.IDictionary<String,Object>
Buttons(System.Action)
Specifies the buttons of ButtonGroup.
Parameters
configurator - System.Action<ToolBarItemButtonFactory>
The action that configures the buttons.
Example
@(Html.Kendo().ToolBar()
.Name("toolBar")
.Items(items =>
{
items.Add().Buttons(b => b.Add());
})
)
Click(System.Func)
Specifies the click event handler of the button. Applicable only for commands of type button and splitButton.
Parameters
handler - System.Func<Object,Object>
The value that configures the click action.
Example
@(Html.Kendo().ToolBar()
.Name("toolBar")
.Items(items =>
{
items.Add().Click(@<text>
function(e) {
// Handle the Click event inline.
}
</text>);
})
)
Click(System.String)
Specifies the click event handler of the button. Applicable only for commands of type button and splitButton.
Parameters
handler - System.String
The value that configures the click action.
Example
@(Html.Kendo().ToolBar()
.Name("toolBar")
.Items(items =>
{
items.Add().Click("onClick");
})
)
Enable(System.Boolean)
Specifies whether the control is initially enabled or disabled. Default value is "true".
Parameters
value - System.Boolean
The value that configures the enable.
Example
@(Html.Kendo().ToolBar()
.Name("toolBar")
.Items(items =>
{
items.Add().Enable(false);
})
)
Group(System.String)
Assigns the button to a group. Applicable only for buttons with togglable: true.
Parameters
value - System.String
The value that configures the group.
Example
@(Html.Kendo().ToolBar()
.Name("toolBar")
.Items(items =>
{
items.Add().Group("groupName");
})
)
Hidden(System.Boolean)
Determines if a button is visible or hidden. By default buttons are visible.
Parameters
value - System.Boolean
The value that configures the hidden.
Example
@(Html.Kendo().ToolBar()
.Name("toolBar")
.Items(items =>
{
items.Add().Hidden(true);
})
)
Icon(System.String)
Sets icon for the item. The icon should be one of the existing in the Kendo UI theme sprite.
Parameters
value - System.String
The value that configures the icon.
Example
@(Html.Kendo().ToolBar()
.Name("toolBar")
.Items(items =>
{
items.Add().Icon("gear");
})
)
Id(System.String)
Specifies the ID of the button.
Parameters
value - System.String
The value that configures the id.
Example
@(Html.Kendo().ToolBar()
.Name("toolBar")
.Items(items =>
{
items.Add().Id("itemId");
})
)
ImageUrl(System.String)
If set, the ToolBar will render an image with the specified URL in the button.
Parameters
value - System.String
The value that configures the imageurl.
Example
@(Html.Kendo().ToolBar()
.Name("toolBar")
.Items(items =>
{
items.Add().ImageUrl("imageUrl");
})
)
MenuButtons(System.Action)
Specifies the menu buttons of a SplitButton or a DropDownButton.
Parameters
configurator - System.Action<ToolBarItemMenuButtonFactory>
The action that configures the menubuttons.
Example
@(Html.Kendo().ToolBar()
.Name("toolBar")
.Items(items =>
{
items.Add().MenuButtons(m => m.Add());
})
)
OverflowTemplate(System.String)
Specifies what element will be added in the command overflow popup. Applicable only for items that have a template.
Parameters
value - System.String
The value that configures the overflowtemplate.
Example
@(Html.Kendo().ToolBar()
.Name("toolBar")
.Items(items =>
{
items.Add().OverflowTemplate("<span>Overflow template</span>");
})
)
OverflowTemplateId(System.String)
Specifies what element will be added in the command overflow popup. Applicable only for items that have a template.
Parameters
value - System.String
The value that configures the overflowtemplate.
Example
@(Html.Kendo().ToolBar()
.Name("toolBar")
.Items(items =>
{
items.Add().OverflowTemplateId("overflowTemplateId");
})
)
OverflowTemplateView(System.Web.Mvc.MvcHtmlString)
Specifies what element will be added in the command overflow popup. Applicable only for items that have a template.
Parameters
value - System.Web.Mvc.MvcHtmlString
The value that configures the overflowtemplate.
Example
@(Html.Kendo().ToolBar()
.Name("toolBar")
.Items(items =>
{
items.Add().OverflowTemplateView(Html.Partial("YourPartialViewName"));
})
)
OverflowTemplateHandler(System.String)
Specifies what element will be added in the command overflow popup. Applicable only for items that have a template.
Parameters
value - System.String
The value that configures the overflowtemplate.
Example
@(Html.Kendo().ToolBar()
.Name("toolBar")
.Items(items =>
{
items.Add().OverflowTemplateHandler("handler");
})
)
OverflowTemplate(Kendo.Mvc.UI.TemplateBuilder)
Specifies what element will be added in the command overflow popup. Applicable only for items that have a template.
Parameters
template - TemplateBuilder<TModel>
A Template component that configures the overflowtemplate.
Example
@(Html.Kendo().ToolBar()
.Name("toolBar")
.Items(items =>
{
items.Add().OverflowTemplate(Html.Kendo().Template().AddComponent(a => a.TextBox()));
})
)
Primary(System.Boolean)
Specifies whether the button is primary. Primary buttons receive different styling.
Parameters
value - System.Boolean
The value that configures the primary.
Example
@(Html.Kendo().ToolBar()
.Name("toolBar")
.Items(items =>
{
items.Add().Primary(true);
})
)
Selected(System.Boolean)
Specifies if the toggle button is initially selected. Applicable only for buttons with togglable: true.
Parameters
value - System.Boolean
The value that configures the selected.
Example
@(Html.Kendo().ToolBar()
.Name("toolBar")
.Items(items =>
{
items.Add().Selected(true);
})
)
SpriteCssClass(System.String)
Defines a CSS class (or multiple classes separated by spaces) which will be used for button icon.
Parameters
value - System.String
The value that configures the spritecssclass.
Example
@(Html.Kendo().ToolBar()
.Name("toolBar")
.Items(items =>
{
items.Add().SpriteCssClass("k-icon k-font-icon k-i-refresh");
})
)
Template(System.String)
Specifies what element will be added in the ToolBar wrapper. Items with template does not have a type.
Parameters
value - System.String
The value that configures the template.
Example
@(Html.Kendo().ToolBar()
.Name("toolBar")
.Items(items =>
{
items.Add().Template("template");
})
)
TemplateId(System.String)
Specifies what element will be added in the ToolBar wrapper. Items with template does not have a type.
Parameters
value - System.String
The value that configures the template.
Example
@(Html.Kendo().ToolBar()
.Name("toolBar")
.Items(items =>
{
items.Add().TemplateId("templateId");
})
)
TemplateView(System.Web.Mvc.MvcHtmlString)
Specifies what element will be added in the ToolBar wrapper. Items with template does not have a type.
Parameters
value - System.Web.Mvc.MvcHtmlString
The value that configures the template.
Example
@(Html.Kendo().ToolBar()
.Name("toolBar")
.Items(items =>
{
items.Add().TemplateView(Html.Partial("YourPartialViewName"));
})
)
TemplateHandler(System.String)
Specifies what element will be added in the ToolBar wrapper. Items with template does not have a type.
Parameters
value - System.String
The value that configures the template.
Example
@(Html.Kendo().ToolBar()
.Name("toolBar")
.Items(items =>
{
items.Add().TemplateHandler("handler");
})
)
Template(Kendo.Mvc.UI.TemplateBuilder)
Specifies what element will be added in the ToolBar wrapper. Items with template does not have a type.
Parameters
template - TemplateBuilder<TModel>
A Template component that configures the template.
Example
@(Html.Kendo().ToolBar()
.Name("toolBar")
.Items(items =>
{
items.Add().Template(Html.Kendo().Template().AddComponent(a => a.TextBox()));
})
)
Text(System.String)
Sets the text of the button.
Parameters
value - System.String
The value that configures the text.
Example
@(Html.Kendo().ToolBar()
.Name("toolBar")
.Items(items =>
{
items.Add().Text("itemText");
})
)
Togglable(System.Boolean)
Specifies if the button is togglable, e.g. has a selected and unselected state.
Parameters
value - System.Boolean
The value that configures the togglable.
Example
@(Html.Kendo().ToolBar()
.Name("toolBar")
.Items(items =>
{
items.Add().Type(CommandType.Button).Togglable(true);
})
)
Toggle(System.Func)
Specifies the toggle event handler of the button. Applicable only for commands of type button and togglable: true.
Parameters
handler - System.Func<Object,Object>
The value that configures the toggle action.
Example
);
})
)
Toggle(System.String)
Specifies the toggle event handler of the button. Applicable only for commands of type button and togglable: true.
Parameters
handler - System.String
The value that configures the toggle action.
Example
@(Html.Kendo().ToolBar()
.Name("toolBar")
.Items(items =>
{
items.Add().Type(CommandType.Button).Togglable(true).Toggle("handler");
})
)
Url(System.String)
Specifies the url to navigate to.
Parameters
value - System.String
The value that configures the url.
Example
@(Html.Kendo().ToolBar()
.Name("toolBar")
.Items(items =>
{
items.Add().Url("url");
})
)
Type(Kendo.Mvc.UI.CommandType)
Specifies the type of the item.
Parameters
value - CommandType
The value that configures the type.
Example
@(Html.Kendo().ToolBar()
.Name("toolBar")
.Items(items =>
{
items.Add().Type(CommandType.Button);
})
)
ShowText(Kendo.Mvc.UI.ShowIn)
Specifies where the text will be displayed.
Parameters
value - ShowIn
The value that configures the showtext.
Example
@(Html.Kendo().ToolBar()
.Name("toolBar")
.Items(items =>
{
items.Add().ShowText(ShowIn.Overflow);
})
)
ShowIcon(Kendo.Mvc.UI.ShowIn)
Specifies where the icon will be displayed.
Parameters
value - ShowIn
The value that configures the showicon.
Example
@(Html.Kendo().ToolBar()
.Name("toolBar")
.Items(items =>
{
items.Add().ShowIcon(ShowIn.Overflow);
})
)
Overflow(Kendo.Mvc.UI.ShowInOverflowPopup)
Specifies how the button behaves when the ToolBar is resized.
Parameters
value - ShowInOverflowPopup
The value that configures the overflow.
Example
@(Html.Kendo().ToolBar()
.Name("toolBar")
.Items(items =>
{
items.Add().Overflow(ShowInOverflowPopup.Auto);
})
)