Here's a sample of what I'm trying to achieve:
@Html.EditorFor(m => m.Description,
new { htmlAttributes =
new
{
@class = "form-control",
@readonly = Model.IsReadOnly,
disabled = Model.IsDisabled
}
})
The problem is that the browser treats the existence of the readonly
and disabled
tokens without checking for their content, so when the IsReadOnly
and IsDisabled
properties are false
, it will still show as disabled
.
Is there any simple solution for that?