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

ButtonBuilder

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().Button()
                        .Name("Button1")
                        .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().Button()
                   .Name("Button1")
                   .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().Button()
                     .Name("Button")
                      .Content("<p>Content</p>")
            )

Enable(System.Boolean)

Sets whether Button should be enabled.

Parameters

value - System.Boolean

Icon(System.String)

Sets the icon name of the Button.

Parameters

icon - System.String

ImageUrl(System.String)

Sets the image URL of the Button.

Parameters

url - System.String

SpriteCssClass(System.String)

Sets the sprite CSS class(es) of the Button.

Parameters

cssClass - System.String

Events(System.Action)

Configures the client-side events.

Parameters

events - System.Action<ButtonEventBuilder>

The client events action.

Example


            @( Html.Kendo().Button()
                       .Name("Button")
                       .Events(events =>
                           events.Click("onClick"))
            )

Tag(System.String)

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

Parameters

tag - System.String

Example


            @( Html.Kendo().Button()
                       .Name("Button")
                       .Tag("span")
            )

Badge(System.Action)

If set to true a default overlay badge will be displayed. If set to a string, an ovelay 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<ButtonBadgeSettingsBuilder>

The configurator for the badge setting.

Badge(System.String)

Sets the value of the badge

Parameters

value - System.String

The value of the badge.

Badge(System.Boolean)

Enables the badge

Parameters

enabled - System.Boolean

Specifies whether the badge is enabled.

Size(Kendo.Mvc.UI.ComponentSize)

Sets the size of the component.

Parameters

value - ComponentSize

The value for Size

Rounded(Kendo.Mvc.UI.Rounded)

Sets a value controlling the border radius.

Parameters

value - Rounded

The value for Rounded

FillMode(Kendo.Mvc.UI.ButtonFillMode)

Sets a value controlling how the color is applied.

Parameters

value - ButtonFillMode

The value for FillMode

ThemeColor(Kendo.Mvc.UI.ThemeColor)

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

Parameters

value - ThemeColor

The value for ThemeColor

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

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>

AsModule(System.Boolean)

Specifies whether the initialization script of the component will be rendered as a JavaScript module.

Parameters

value - System.Boolean

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();
            )

ScriptAttributes(System.Object,System.Boolean)

Sets the JavaScript attributes to the initialization script.

Parameters

attributes - System.Object

The JavaScript attributes.

overrideAttributes - System.Boolean

Argument which determines whether attributes should be overriden.

ScriptAttributes(System.Collections.Generic.IDictionary,System.Boolean)

Sets the JavaScript attributes to the initialization script.

Parameters

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

The JavaScript attributes.

overrideAttributes - System.Boolean

Argument which determines whether attributes should be overriden.

ToHtmlString()

ToClientTemplate()

In this article
Not finding the help you need?