ToolBarItemButtonBuilder
Methods
HtmlAttributes(System.Object)
Specifies the HTML attributes of a ButtonGroup's 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 = "custom-button", id = "customButtonId" });
})
)
HtmlAttributes(System.Collections.Generic.IDictionary)
Specifies the HTML attributes of a ButtonGroup's button.
Parameters
value - System.Collections.Generic.IDictionary<String,Object>
The value that configures the htmlattributes.
Example
@(Html.Kendo().ToolBar()
.Name("toolBar")
.Items(items =>
{
items.Add().Type(CommandType.Button).Text("Button").HtmlAttributes(new Dictionary<string, object>
{
{ "class", "custom-button" },
{ "id", "customButtonId" },
{ "data-role", "button" }
});
})
)
Click(System.Func)
Specifies the click event handler of the button. Applicable only for the children of a ButtonGroup.
Parameters
handler - System.Func<Object,Object>
The value that configures the click action.
Example
);
})
)
Click(System.String)
Specifies the click event handler of the button. Applicable only for the children of a ButtonGroup.
Parameters
handler - System.String
The value that configures the click action.
Example
@(Html.Kendo().ToolBar()
.Name("toolBar")
.Items(items =>
{
items.Add()
.Type(CommandType.Button)
.Text("Click Me")
.Click("onClick");
})
)
Enable(System.Boolean)
Specifies whether the button is initially enabled or disabled.
Parameters
value - System.Boolean
The value that configures the enable.
Example
@(Html.Kendo().ToolBar()
.Name("toolBar")
.Items(items =>
{
items.Add().Type(CommandType.Button).Text("Button").Enable(true);
})
)
Group(System.String)
Assigns the button to a group. Applicable only for the children of a ButtonGroup that has togglable true.
Parameters
value - System.String
The value that configures the group.
Example
@(Html.Kendo().ToolBar()
.Name("toolBar")
.Items(items =>
{
items.Add().Type(CommandType.Button).Text("Button").Group("groupName");
})
)
Hidden(System.Boolean)
Determines if the button is visible or hidden. By default the buttons are visible.
Parameters
value - System.Boolean
The value that configures the hidden.
Example
@(Html.Kendo().ToolBar()
.Name("toolBar")
.Items(items =>
{
items.Add().Type(CommandType.Button).Text("Button").Hidden(true);
})
)
Icon(System.String)
Sets icon for the menu button. 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().Type(CommandType.Button).Text("Button").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().Type(CommandType.Button).Text("Button").Id("id");
})
)
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().Type(CommandType.Button).Text("Button").ImageUrl("imageUrl");
})
)
Selected(System.Boolean)
Specifies if the toggle button is initially selected. Applicable only for the children of a ButtonGroup that has togglable true.
Parameters
value - System.Boolean
The value that configures the selected.
Example
@(Html.Kendo().ToolBar()
.Name("toolBar")
.Items(items =>
{
items.Add().Type(CommandType.Button).Text("Button").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().Type(CommandType.Button).Text("Button").SpriteCssClass("k-icon k-font-icon k-i-refresh");
})
)
Toggle(System.Func)
Specifies the toggle event handler of the button. Applicable only for the children of a ButtonGroup.
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 the children of a ButtonGroup.
Parameters
handler - System.String
The value that configures the toggle action.
Example
@(Html.Kendo().ToolBar()
.Name("toolBar")
.Items(items =>
{
items.Add()
.Type(CommandType.Button)
.Text("Toggle Me")
.Togglable(true)
.Toggle("onToogle");
})
)
Togglable(System.Boolean)
Specifies if the button is togglable, e.g. has a selected and unselected state. Applicable only for the children of a ButtonGroup.
Parameters
value - System.Boolean
The value that configures the togglable.
Example
@(Html.Kendo().ToolBar()
.Name("toolBar")
.Items(items =>
{
items.Add()
.Type(CommandType.Button)
.Text("Toggle Me")
.Togglable(true);
})
)
Text(System.String)
Specifies the text of the menu button.
Parameters
value - System.String
The value that configures the text.
Example
@(Html.Kendo().ToolBar()
.Name("toolBar")
.Items(items =>
{
items.Add()
.Type(CommandType.Button)
.Text("Toggle Me");
})
)
Url(System.String)
Specifies the url of the button to navigate to.
Parameters
value - System.String
The value that configures the url.
Example
@(Html.Kendo().ToolBar()
.Name("toolBar")
.Items(items =>
{
items.Add()
.Type(CommandType.Button)
.Text("Toggle Me");
.Url("url");
})
)
ShowText(Kendo.Mvc.UI.ShowIn)
Specifies where the text of the menu button will be displayed. Applicable only for the buttons of a ButtonGroup.
Parameters
value - ShowIn
The value that configures the showtext.
Example
@(Html.Kendo().ToolBar()
.Name("toolBar")
.Items(items =>
{
items.Add()
.Type(CommandType.Button)
.Text("Toggle Me");
.ShowText(ShowIn.Overflow);
})
)
ShowIcon(Kendo.Mvc.UI.ShowIn)
Specifies where the icon of the button will be displayed. Applicable only for the children of a ButtonGroup.
Parameters
value - ShowIn
The value that configures the showicon.
Example
@(Html.Kendo().ToolBar()
.Name("toolBar")
.Items(items =>
{
items.Add()
.Type(CommandType.Button)
.Text("Toggle Me");
.ShowIcon(ShowIn.Overflow);
})
)