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

Defines the fluent API for configuring the Kendo ToggleButton for ASP.NET MVC.

Definition

Namespace:Kendo.Mvc.UI.Fluent

Assembly:Kendo.Mvc.dll

Syntax:

C#
public class ToggleButtonBuilder : WidgetBuilderBase<ToggleButton, ToggleButtonBuilder>, IHtmlString

Inheritance: objectWidgetBuilderBase<ToggleButton, ToggleButtonBuilder>ToggleButtonBuilder

Implements: IHtmlString

Inherited Members WidgetBuilderBase<ToggleButton, ToggleButtonBuilder>.ToComponent()WidgetBuilderBase<ToggleButton, ToggleButtonBuilder>.Name(string)WidgetBuilderBase<ToggleButton, ToggleButtonBuilder>.Deferred(bool)WidgetBuilderBase<ToggleButton, ToggleButtonBuilder>.ModelMetadata(ModelMetadata)WidgetBuilderBase<ToggleButton, ToggleButtonBuilder>.HtmlAttributes(object)WidgetBuilderBase<ToggleButton, ToggleButtonBuilder>.HtmlAttributes(IDictionary<string, object>)WidgetBuilderBase<ToggleButton, ToggleButtonBuilder>.AsModule(bool)WidgetBuilderBase<ToggleButton, ToggleButtonBuilder>.Render()WidgetBuilderBase<ToggleButton, ToggleButtonBuilder>.ScriptAttributes(object, bool)WidgetBuilderBase<ToggleButton, ToggleButtonBuilder>.ScriptAttributes(IDictionary<string, object>, bool)WidgetBuilderBase<ToggleButton, ToggleButtonBuilder>.ToHtmlString()WidgetBuilderBase<ToggleButton, ToggleButtonBuilder>.ToClientTemplate()WidgetBuilderBase<ToggleButton, ToggleButtonBuilder>.ToString()WidgetBuilderBase<ToggleButton, ToggleButtonBuilder>.Componentobject.GetType()object.MemberwiseClone()object.ToString()object.Equals(object)object.Equals(object, object)object.ReferenceEquals(object, object)object.GetHashCode()...

Constructors

Initializes a new instance of the ToggleButton class.

C#
public ToggleButtonBuilder(ToggleButton component)
Parameters:componentToggleButton

The component.

Methods

If set to true a default overlay badge will be displayed. If set to a string, an overlay with content set to the specified string will be displayed. Can be set to a JavaScript object which represents the configuration of the Badge widget.

C#
public ToggleButtonBuilder Badge(Action<ToggleButtonBadgeSettingsBuilder> configurator)
Parameters:configuratorAction<ToggleButtonBadgeSettingsBuilder>

The action that configures the badge.

Returns:

ToggleButtonBuilder

Sets the HTML content of the Button.

C#
public ToggleButtonBuilder Content(Action content)
Parameters:contentAction

The action which renders the HTML content.

Returns:

ToggleButtonBuilder

Example:
C#
@(  Html.Kendo().ToggleButton()
.Name("togglebutton")
.Content(() =&gt; { &gt;%
&lt;p&gt;Content&lt;/p&gt;
%&lt;})
.Render();
)

Sets the HTML content of the Button.

C#
public ToggleButtonBuilder Content(Func<object, object> content)
Parameters:contentFunc<object, object>

The Razor template for the HTML content.

Returns:

ToggleButtonBuilder

Example:
C#
@(Html.Kendo().ToggleButton()
.Name("togglebutton")
.Content(@&lt;p&gt;Content&lt;/p&gt;)
.Render();)

Sets the HTML content of the Button.

C#
public ToggleButtonBuilder Content(string content)
Parameters:contentstring

The HTML content.

Returns:

ToggleButtonBuilder

Example:
C#
@( Html.Kendo().ToggleButton()
.Name("togglebutton")
.Content("&lt;p&gt;Content&lt;/p&gt;")
)

Sets whether the component should be enabled or disabled.

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

The value that configures the enable.

Returns:

ToggleButtonBuilder

Configures the client-side events.

C#
public ToggleButtonBuilder Events(Action<ToggleButtonEventBuilder> configurator)
Parameters:configuratorAction<ToggleButtonEventBuilder>

The client events action.

Returns:

ToggleButtonBuilder

Example:
C#
@(Html.Kendo().ToggleButton()
.Name("ToggleButton")
.Events(events =&gt; events
.Toggle("onToggle")
)
)

Sets a value controlling how the color is applied.

C#
public ToggleButtonBuilder FillMode(FillMode value)
Parameters:valueFillMode

The value that configures the fillmode.

Returns:

ToggleButtonBuilder

Specifies a group of ToggleButtons the current instance belongs to. The string will be rendered as a value of the data-group attribute of the widget's element.

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

The value that configures the group.

Returns:

ToggleButtonBuilder

Sets the icon of the component.

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

The value that configures the icon.

Returns:

ToggleButtonBuilder

Sets the icon class of the component.

C#
public ToggleButtonBuilder IconClass(string value)
Parameters:valuestring

The value that configures the iconclass.

Returns:

ToggleButtonBuilder

Sets the image url for the and img element inside the component.

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

The value that configures the imageurl.

Returns:

ToggleButtonBuilder

Sets a value controlling the border radius.

C#
public ToggleButtonBuilder Rounded(Rounded value)
Parameters:valueRounded

The value that configures the rounded.

Returns:

ToggleButtonBuilder

Specifies the selected state of the ToggleButtons. If set to true the widget will be initially selected.

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

The value that configures the selected.

Returns:

ToggleButtonBuilder

Sets the size of the component.

C#
public ToggleButtonBuilder Size(ButtonSize value)
Parameters:valueButtonSize

The value that configures the size.

Returns:

ToggleButtonBuilder

Sets the CSS class, which will be used for applying a background image to a span element inside the component.

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

The value that configures the spritecssclass.

Returns:

ToggleButtonBuilder

Sets the ToggleButton HTML tag. A button tag is used by default.

C#
public ToggleButtonBuilder Tag(string tag)
Parameters:tagstring

The name of the Html element from which the button is initialized.

Returns:

ToggleButtonBuilder

Example:
C#
@( Html.Kendo().ToggleButton()
.Name("Button")
.Tag("a")
)

Sets the color of the component according to the applied theme.

C#
public ToggleButtonBuilder ThemeColor(ThemeColor value)
Parameters:valueThemeColor

The value that configures the themecolor.

Returns:

ToggleButtonBuilder