I have a situation where I want to display a button as being enabled or disabled depending on a property which has been set on the view model.
@if (Model.CanBeDe
Do the check once and have the disabled property be determined by a temporary variable called enabled.
@code var enabled = "disabled='disabled'"; if(Model.CanBeDeleted) enabled = ""; end code Delete