Today, if a user puts the following in a CSHTML page:
@Html.TextBox("myname", "mytext", new { disabled = isDisabled })
this will render a "disabled" attribute whose value will be set to True or False. This is inconsistent with HTML's handling of boolean attributes, and it's also inconsistent with the work we did in Razor v2 to support conditional attributes in Razor markup.
This suggestion is to add conditional attribute logic to the Html helpers so the above would conditionally display the disabled attribute (provided that isDisabled is a boolean).
Comments: I think this should also handle null values as asked in [this StackOverflow question](http://stackoverflow.com/questions/16673903/inconsistent-null-attribute-handling-in-asp-net-mvc-4).
@Html.TextBox("myname", "mytext", new { disabled = isDisabled })
this will render a "disabled" attribute whose value will be set to True or False. This is inconsistent with HTML's handling of boolean attributes, and it's also inconsistent with the work we did in Razor v2 to support conditional attributes in Razor markup.
This suggestion is to add conditional attribute logic to the Html helpers so the above would conditionally display the disabled attribute (provided that isDisabled is a boolean).
Comments: I think this should also handle null values as asked in [this StackOverflow question](http://stackoverflow.com/questions/16673903/inconsistent-null-attribute-handling-in-asp-net-mvc-4).