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

Defines the fluent API for configuring ToolBarItemButton

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

ToolBarItemButtonBuilder method.

C#
public ToolBarItemButtonBuilder(ToolBarItemButton container)
Parameters:containerToolBarItemButton

Properties

Gets the settings being configured.

C#
protected ToolBarItemButton Container { get; }

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 handler code wrapped in a text tag.

Returns:

ToolBarItemButtonBuilder

Returns the current ToolBarItemButtonBuilder instance.

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 name of the JavaScript function that will be evaluated.

Returns:

ToolBarItemButtonBuilder

Returns the current ToolBarItemButtonBuilder instance.

Specifies whether the button is initially enabled or disabled.

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

The value for Enable

Returns:

ToolBarItemButtonBuilder

Returns the current ToolBarItemButtonBuilder instance.

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 for Group

Returns:

ToolBarItemButtonBuilder

Returns the current ToolBarItemButtonBuilder instance.

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()
Returns:

ToolBarItemButtonBuilder

Returns the current ToolBarItemButtonBuilder instance.

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

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

The value for Hidden

Returns:

ToolBarItemButtonBuilder

Returns the current ToolBarItemButtonBuilder instance.

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 for HtmlAttributes

Returns:

ToolBarItemButtonBuilder

Returns the current ToolBarItemButtonBuilder instance.

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 for HtmlAttributes

Returns:

ToolBarItemButtonBuilder

Returns the current ToolBarItemButtonBuilder instance.

Sets icon for the menu button. The icon should be one of the existing in the Kendo UI theme sprite.Set this option to an icon descriptor such as { name: "gear", variant: "outline" }. The variant can be outline, solid, or duotone; it applies to SVG rendering and is ignored for font icons.

C#
public ToolBarItemButtonBuilder Icon(Action<ToolBarItemButtonIconSettingsBuilder> configurator)
Parameters:configuratorAction<ToolBarItemButtonIconSettingsBuilder>

The ToolBarItemButtonIconSettingsBuilder for the icon setting.

Returns:

ToolBarItemButtonBuilder

Returns the current instance of ToolBarItemButtonBuilder .

Sets icon for the menu button. The icon should be one of the existing in the Kendo UI theme sprite.Set this option to an icon descriptor such as { name: "gear", variant: "outline" }. The variant can be outline, solid, or duotone; it applies to SVG rendering and is ignored for font icons.

C#
public ToolBarItemButtonBuilder Icon(string icon)
Parameters:iconstring

The icon.

Returns:

ToolBarItemButtonBuilder

Returns the current instance of ToolBarItemButtonBuilder .

Specifies the ID of the button.

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

The value for Id

Returns:

ToolBarItemButtonBuilder

Returns the current ToolBarItemButtonBuilder instance.

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 for ImageUrl

Returns:

ToolBarItemButtonBuilder

Returns the current ToolBarItemButtonBuilder instance.

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()
Returns:

ToolBarItemButtonBuilder

Returns the current ToolBarItemButtonBuilder instance.

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 for Selected

Returns:

ToolBarItemButtonBuilder

Returns the current ToolBarItemButtonBuilder instance.

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 for ShowIcon

Returns:

ToolBarItemButtonBuilder

Returns the current ToolBarItemButtonBuilder instance.

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 for ShowText

Returns:

ToolBarItemButtonBuilder

Returns the current ToolBarItemButtonBuilder instance.

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 for SpriteCssClass

Returns:

ToolBarItemButtonBuilder

Returns the current ToolBarItemButtonBuilder instance.

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 for Text

Returns:

ToolBarItemButtonBuilder

Returns the current ToolBarItemButtonBuilder instance.

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 for Togglable

Returns:

ToolBarItemButtonBuilder

Returns the current ToolBarItemButtonBuilder instance.

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 handler code wrapped in a text tag.

Returns:

ToolBarItemButtonBuilder

Returns the current ToolBarItemButtonBuilder instance.

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 name of the JavaScript function that will be evaluated.

Returns:

ToolBarItemButtonBuilder

Returns the current ToolBarItemButtonBuilder instance.

Specifies the url of the button to navigate to.

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

The value for Url

Returns:

ToolBarItemButtonBuilder

Returns the current ToolBarItemButtonBuilder instance.

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