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

Disabled Button

The business logic of an application often requires a certain button to be temporarily disabled or enabled.

By default, the Button is enabled, but you can disable it by any of the following methods:

  • Set the enable attribute to "false".

<kendo-button name="disabledButton" enable="false">Disabled button</kendo-button>


        @(Html.Kendo().Button()
            .Name("disabledButton")
            .Enable(false)
            .Content("Disabled button"))

  • Use either ViewData or ViewBag attributes. The example below illustrates a disabled Button through the ViewData attribute.

<kendo-button name="disabledButton" enable='(bool)@ViewData["IsEnabled"]'>Disabled button</kendo-button>


        public IActionResult Index()
        {
            ViewData["IsEnabled"] = false;
            return View();
        }

  • Disable the Button at runtime with JavaScript by using its enable() method with a Boolean argument.

<kendo-button name="editButton">Edit</kendo-button>


<script>
    var isAdmin = false;
    var buttonWidget = $("#editButton").data("kendoButton"); // Use the [`jQuery.data()`](http://api.jquery.com/jQuery.data/) configuration option to get an instance of the Button TagHelper
    if(!isAdmin) {
        buttonWidget.enable(false); // disable the button
    } else {
        buttonWidget.enable(true);  // enable the button
    }
</script>

See Also

In this article
Not finding the help you need? Improve this article