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

Defines the fluent API for configuring the Kendo UI ToggleButton

Definition

Namespace:Kendo.Mvc.UI.Fluent

Assembly:Kendo.Mvc.dll

Syntax:

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

Inheritance: objectHelperResultWidgetBuilderBase<ToggleButton, ToggleButtonBuilder>ToggleButtonBuilder

Implements: IHtmlContent

Inherited Members WidgetBuilderBase<ToggleButton, ToggleButtonBuilder>.ToComponent()WidgetBuilderBase<ToggleButton, ToggleButtonBuilder>.Expression(string)WidgetBuilderBase<ToggleButton, ToggleButtonBuilder>.Explorer(ModelExplorer)WidgetBuilderBase<ToggleButton, ToggleButtonBuilder>.Name(string)WidgetBuilderBase<ToggleButton, ToggleButtonBuilder>.Deferred(bool)WidgetBuilderBase<ToggleButton, ToggleButtonBuilder>.HtmlAttributes(object)WidgetBuilderBase<ToggleButton, ToggleButtonBuilder>.HtmlAttributes(IDictionary<string, object>)WidgetBuilderBase<ToggleButton, ToggleButtonBuilder>.ScriptAttributes(object, bool)WidgetBuilderBase<ToggleButton, ToggleButtonBuilder>.ScriptAttributes(IDictionary<string, object>, bool)WidgetBuilderBase<ToggleButton, ToggleButtonBuilder>.Render()WidgetBuilderBase<ToggleButton, ToggleButtonBuilder>.ToHtmlString()WidgetBuilderBase<ToggleButton, ToggleButtonBuilder>.WriteTo(TextWriter, HtmlEncoder)WidgetBuilderBase<ToggleButton, ToggleButtonBuilder>.ToClientTemplate()WidgetBuilderBase<ToggleButton, ToggleButtonBuilder>.AsModule(bool)WidgetBuilderBase<ToggleButton, ToggleButtonBuilder>.ComponentWidgetBuilderBase<ToggleButton, ToggleButtonBuilder>.ContainerHelperResult.WriteTo(TextWriter, HtmlEncoder)HelperResult.WriteActionobject.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 ToggleButtonBuilder class.

C#
public ToggleButtonBuilder(ToggleButton component)
Parameters:componentToggleButton

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 ToggleButtonBadgeSettingsBuilder for the badge setting.

Returns:

ToggleButtonBuilder

Returns the current instance of ToggleButtonBuilder .

Sets the HTML content of the ToggleButton.

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

The action which renders the HTML content.

Returns:

ToggleButtonBuilder

Returns the current ToggleButtonBuilder instance.

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 ToggleButton.

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

The Razor template for the HTML content.

Returns:

ToggleButtonBuilder

Returns the current ToggleButtonBuilder instance.

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

Returns the current ToggleButtonBuilder instance.

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

Returns:

ToggleButtonBuilder

Returns the current ToggleButtonBuilder instance.

Sets the end icon of the component.

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

The value for EndIcon

Returns:

ToggleButtonBuilder

Returns the current ToggleButtonBuilder instance.

Configures the client-side events.

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

The client events action.

Returns:

ToggleButtonBuilder

Returns the current ToggleButtonBuilder instance.

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

Returns:

ToggleButtonBuilder

Returns the current ToggleButtonBuilder instance.

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

Returns:

ToggleButtonBuilder

Returns the current ToggleButtonBuilder instance.

Defines custom attributes of the ToggleButton's element.

C#
public override ToggleButtonBuilder HtmlAttributes(IDictionary<string, object> attributes)
Parameters:attributesIDictionary<string, object>

The value for HtmlAttributes

Returns:

ToggleButtonBuilder

Returns the current ToggleButtonBuilder instance.

Overrides: WidgetBuilderBase<ToggleButton, ToggleButtonBuilder>.HtmlAttributes(IDictionary<string, object>)

Example:
C#
@( Html.Kendo().ToggleButton()
.Name("Button")
.HtmlAttributes(new Dictionary&lt;string, object&gt;() { {"class", "foo"} })
)

Defines custom attributes of the ToggleButton's element.

C#
public override ToggleButtonBuilder HtmlAttributes(object attributes)
Parameters:attributesobject

The value for HtmlAttributes

Returns:

ToggleButtonBuilder

Returns the current ToggleButtonBuilder instance.

Overrides: WidgetBuilderBase<ToggleButton, ToggleButtonBuilder>.HtmlAttributes(object)

Example:
C#
@( Html.Kendo().ToggleButton()
.Name("Button")
.HtmlAttributes(new {@class = "foo"})
)

Sets the icon of the component.

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

The value for Icon

Returns:

ToggleButtonBuilder

Returns the current ToggleButtonBuilder instance.

Sets the icon class of the component.

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

The value for IconClass

Returns:

ToggleButtonBuilder

Returns the current ToggleButtonBuilder instance.

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

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

The value for ImageUrl

Returns:

ToggleButtonBuilder

Returns the current ToggleButtonBuilder instance.

Sets a value controlling the border radius.

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

The value for Rounded

Returns:

ToggleButtonBuilder

Returns the current ToggleButtonBuilder instance.

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

C#
public ToggleButtonBuilder Selected()
Returns:

ToggleButtonBuilder

Returns the current ToggleButtonBuilder instance.

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

Returns:

ToggleButtonBuilder

Returns the current ToggleButtonBuilder instance.

Sets the size of the component.

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

The value for Size

Returns:

ToggleButtonBuilder

Returns the current ToggleButtonBuilder instance.

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

Returns:

ToggleButtonBuilder

Returns the current ToggleButtonBuilder instance.

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

Returns the current ToggleButtonBuilder instance.

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

Returns:

ToggleButtonBuilder

Returns the current ToggleButtonBuilder instance.