Reputation: 10590
i have a model contains a bool value,
when i present that value in the view i got this image
Upvotes: 0
Views: 80
Reputation: 39817
It all depends on how you present the data (mark up) in your view.
@Html.EditorFor(m=>m.BoolValue)
-> renders a checkbox so that the user can "edit" the data.
@Html.LabelFor(m=>m.BoolValue)
-> renders the string "BoolValue" unless you have a data annotation ([DisplayName("Some New Name")]
) naming it something different. This is to generate a label to associate with a checkbox.
@model.BoolValue
-> Will render true or false, whatever the value of the BoolValue variable is.
Upvotes: 1
Reputation: 14640
Rather than using Html.EditorFor
, you simply want to use @Model.IsFurnished
.
Html.EditorFor
will provide a checkbox for a bool
because it is the most logical way to represent a value of true
or false
.
Upvotes: 1