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

ToggleButtonBuilder

Methods

Content(System.Action)

Sets the HTML content of the Button.

Parameters

content - System.Action

The action which renders the HTML content.

Example


             @(  Html.Kendo().ToggleButton()
                        .Name("togglebutton")
                        .Content(() => { >%
                              <p>Content</p>
                         %<})
                        .Render();
            )

Content(System.Func)

Sets the HTML content of the Button.

Parameters

content - System.Func<Object,Object>

The Razor template for the HTML content.

Example


             @(Html.Kendo().ToggleButton()
                   .Name("togglebutton")
                   .Content(@<p>Content</p>)
                   .Render();)

Content(System.String)

Sets the HTML content of the Button.

Parameters

content - System.String

The HTML content.

Example


             @( Html.Kendo().ToggleButton()
                     .Name("togglebutton")
                     .Content("<p>Content</p>")
            )

Tag(System.String)

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

Parameters

tag - System.String

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

Example


            @( Html.Kendo().ToggleButton()
                       .Name("Button")
                       .Tag("a")
            )

Group(System.String)

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.

Parameters

value - System.String

The value that configures the group.

Selected(System.Boolean)

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

Parameters

value - System.Boolean

The value that configures the selected.

Badge(System.Action)

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.

Parameters

configurator - System.Action<ToggleButtonBadgeSettingsBuilder>

The action that configures the badge.

Size(Kendo.Mvc.UI.ComponentSize)

Sets the size of the component.

Parameters

value - ComponentSize

The value that configures the size.

Rounded(Kendo.Mvc.UI.Rounded)

Sets a value controlling the border radius.

Parameters

value - Rounded

The value that configures the rounded.

FillMode(Kendo.Mvc.UI.FillMode)

Sets a value controlling how the color is applied.

Parameters

value - FillMode

The value that configures the fillmode.

ThemeColor(Kendo.Mvc.UI.ThemeColor)

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

Parameters

value - ThemeColor

The value that configures the themecolor.

Icon(System.String)

Sets the icon of the component.

Parameters

value - System.String

The value that configures the icon.

IconClass(System.String)

Sets the icon class of the component.

Parameters

value - System.String

The value that configures the iconclass.

ImageUrl(System.String)

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

Parameters

value - System.String

The value that configures the imageurl.

SpriteCssClass(System.String)

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

Parameters

value - System.String

The value that configures the spritecssclass.

Enable(System.Boolean)

Sets whether the component should be enabled or disabled.

Parameters

value - System.Boolean

The value that configures the enable.

Events(System.Action)

Configures the client-side events.

Parameters

configurator - System.Action<ToggleButtonEventBuilder>

The client events action.

Example


            @(Html.Kendo().ToggleButton()
                        .Name("ToggleButton")
                        .Events(events => events
                            .Toggle("onToggle")
                        )
            )

ToComponent()

Returns the internal view component.

Name(System.String)

Sets the name of the component.

Parameters

componentName - System.String

The name of the component.

Example


            @(Html.Kendo().Grid<OrderViewModel>()
               .Name("grid")
               .Columns(columns =>
               {
                   columns.Bound(p => p.OrderID).Filterable(false);
                   columns.Bound(p => p.Freight);  
               })
               .DataSource(dataSource => dataSource
                   .Ajax()
                   .PageSize(20)
                   .Read(read => read.Action("Orders_Read", "Grid"))
               )
            )

Deferred(System.Boolean)

Suppress initialization script rendering. Note that this options should be used in conjunction with Kendo.Mvc.UI.Fluent.WidgetFactory.DeferredScripts(System.Boolean)

Parameters

deferred - System.Boolean

ModelMetadata(System.Web.Mvc.ModelMetadata)

Uses the Metadata of the Model.

Parameters

modelMetadata - System.Web.Mvc.ModelMetadata

The metadata set for the Model

HtmlAttributes(System.Object)

Sets the HTML attributes.

Parameters

attributes - System.Object

The HTML attributes.

HtmlAttributes(System.Collections.Generic.IDictionary)

Parameters

attributes - System.Collections.Generic.IDictionary<String,Object>

AsChildComponent()

Render()

Renders the component.

Example


            @(@Page Inherits="System.Web.Mvc.ViewPage<IEnumerable<Product>>" )
            @( Html.Kendo().Grid(Model)
                .Name("grid")
                .DetailTemplate(product => {
                    )
                       Product Details:
                       <div>Product Name: @( product.ProductName )</div>
                       <div>Units In Stock: @( product.UnitsInStock )</div>
                    @(
                })
                .Render();
            )

ToHtmlString()

ToClientTemplate()

In this article
Not finding the help you need?