Search results

Set the disabled state in ASP.NET MVC Button control

14 Apr 2021 / 1 minute to read

Button component can be enabled/disabled by giving disabled property. To disable Button component, the disabled property can be set as true.

The following example demonstrates Button in disabled state.

razor
disabledbutton.cs
Copied to clipboard
@Html.EJS().Button("disabled").Content("Disabled").Disabled(true).Render()

<style>

button {
  margin: 25px 5px 20px 20px;
}

</style>
Copied to clipboard
public ActionResult DisabledButton()
{
    return View();
}