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

Defines the fluent API for configuring the ToolBarItemButton settings.

Definition

Namespace:Kendo.Mvc.UI.Fluent

Assembly:Kendo.Mvc.dll

Syntax:

C#
public class ToolBarItemButtonBuilder

Inheritance: objectToolBarItemButtonBuilder

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

Constructors

C#
public ToolBarItemButtonBuilder(ToolBarItemButton settings)
Parameters:settingsToolBarItemButton

Methods

Specifies the click event handler of the button. Applicable only for the children of a ButtonGroup.

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

The value that configures the click action.

Returns:

ToolBarItemButtonBuilder

Example:
C#
@(Html.Kendo().ToolBar()
.Name("toolBar")
.Items(items =&gt;
{
items.Add()
.Type(CommandType.Button)
.Text("Click Me")
.Click(@
function(e) {
alert("Button clicked!");
}
);
})
)

Specifies the click event handler of the button. Applicable only for the children of a ButtonGroup.

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

The value that configures the click action.

Returns:

ToolBarItemButtonBuilder

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

Specifies whether the button is initially enabled or disabled.

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

The value that configures the enable.

Returns:

ToolBarItemButtonBuilder

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

Assigns the button to a group. Applicable only for the children of a ButtonGroup that has togglable true.

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

The value that configures the group.

Returns:

ToolBarItemButtonBuilder

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

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

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

The value that configures the hidden.

Returns:

ToolBarItemButtonBuilder

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

Specifies the HTML attributes of a ButtonGroup's button.

C#
public ToolBarItemButtonBuilder HtmlAttributes(IDictionary<string, object> value)
Parameters:valueIDictionary<string, object>

The value that configures the htmlattributes.

Returns:

ToolBarItemButtonBuilder

Example:
C#
@(Html.Kendo().ToolBar()
.Name("toolBar")
.Items(items =&gt;
{
items.Add().Type(CommandType.Button).Text("Button").HtmlAttributes(new Dictionary&lt;string, object&gt;
{
{ "class", "custom-button" },
{ "id", "customButtonId" },
{ "data-role", "button" }
});
})
)

Specifies the HTML attributes of a ButtonGroup's button.

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

The value that configures the htmlattributes.

Returns:

ToolBarItemButtonBuilder

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

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

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

The value that configures the icon.

Returns:

ToolBarItemButtonBuilder

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

Specifies the ID of the button.

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

The value that configures the id.

Returns:

ToolBarItemButtonBuilder

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

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

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

The value that configures the imageurl.

Returns:

ToolBarItemButtonBuilder

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

Specifies if the toggle button is initially selected. Applicable only for the children of a ButtonGroup that has togglable true.

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

The value that configures the selected.

Returns:

ToolBarItemButtonBuilder

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

Specifies where the icon of the button will be displayed. Applicable only for the children of a ButtonGroup.

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

The value that configures the showicon.

Returns:

ToolBarItemButtonBuilder

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

Specifies where the text of the menu button will be displayed. Applicable only for the buttons of a ButtonGroup.

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

The value that configures the showtext.

Returns:

ToolBarItemButtonBuilder

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

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

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

The value that configures the spritecssclass.

Returns:

ToolBarItemButtonBuilder

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

Specifies the text of the menu button.

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

The value that configures the text.

Returns:

ToolBarItemButtonBuilder

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

Specifies if the button is togglable, e.g. has a selected and unselected state. Applicable only for the children of a ButtonGroup.

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

The value that configures the togglable.

Returns:

ToolBarItemButtonBuilder

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

Specifies the toggle event handler of the button. Applicable only for the children of a ButtonGroup.

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

The value that configures the toggle action.

Returns:

ToolBarItemButtonBuilder

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

Specifies the toggle event handler of the button. Applicable only for the children of a ButtonGroup.

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

The value that configures the toggle action.

Returns:

ToolBarItemButtonBuilder

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

Specifies the url of the button to navigate to.

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

The value that configures the url.

Returns:

ToolBarItemButtonBuilder

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