In my HTML code i want to create checkboxes that are readonly and their value depends on a data that a get from the database. Setting the readonly property is fine and so is binding the checkbox with my model. But the value on my model (that came from the database) is integer, not boolean. Currently i'm doing it like this
@Html.CheckBox("myProperty", Model.Property == 2 ? true : false, new { @onclick = "return false" }) <label>Some text for the label</label>
so i am wondering if there is any way to achieve this without the if statement
thank you for any advice
Model.Property == 2instead ofModel.Property == 2 ? true : false- should do the same thing. In case if you should check on for "2"