Edit this page

Button HtmlHelper Overview

The Button HtmlHelper extension is a server-side wrapper for the Kendo UI Button widget.

It enables you to configure the Kendo UI Button widget from server-side code. The Button provides a styled clickable UI functionality with arbitrary content. Apart from consistent Kendo UI styling, the Button provides keyboard operability for elements, which natively do not have it—for example, span.

For more information on the HtmlHelper, refer to the article on the Button HtmlHelper for ASP.NET MVC.

Basic Usage

The following example demonstrates how to define the Button by using the Button HtmlHelper.

Example
@(Html.Kendo().Button()
    .Name("textButton")
    .HtmlAttributes( new {type = "button"} )
    .Content("Text Button")
)

Configuration

The following example demonstrates the basic configuration of the Button HtmlHelper and how to get the Button instance.

Example
@(Html.Kendo().Button()
    .Name("textButton")
    .Tag("span")
    .Content("Text button")
    .HtmlAttributes( new { @class = "k-primary" } )
    .Events(ev => ev.Click("onClick"))
)

<script type="text/javascript">
$(function() {
    //Notice that the Name() of the Button is used to get its client-side instance.
    var button = $("#textButton").data("kendoButton");
});
</script>

See Also