This will change the display type based on your bool Model.EnableCompanyName :)
Hope this helps!
@{ String displayMode = (Model.EnableCompanyName) ? "inline" : "none"; @Html.TextBox("CompanyName", "", new { style = "display:" + displayMode + ";" }) }
Chris
source share