how do you make @Html.CheckBoxFor invisible with use of the htmlAttributes?
I tried:
@Html.CheckBoxFor(modelItem => modelItem.DeleteEnabled, new {visible= @modelItem.Visible})
how do you make @Html.CheckBoxFor invisible with use of the htmlAttributes?
I tried:
@Html.CheckBoxFor(modelItem => modelItem.DeleteEnabled, new {visible= @modelItem.Visible})
You can try like this:
@Html.CheckBoxFor(modelItem => modelItem.DeleteEnabled,
new { style = modelItem.Visible ?
string.empty :
"display:none"})
or if you do not need it at the page source at all, nor even hidden then use @if for example:
@if(modelItem.Visible)
{
@Html.CheckBoxFor(modelItem => modelItem.DeleteEnabled)
}