Using Check Boxes

Exclude variable in our project is a boolean variable. That's why we want to show it as a checkbox, it values only true or false.

The method is same as using radio buttons, even easier.

@Html.CheckBoxFor(m => m.Exclude)
@Html.DisplayNameFor(m => m.Exclude)

Then, for beautfying the display of the checkbox, we are going to used a CSS syntax provided by Bootstrap.

<div class="form-group">
    <div class="checkbox">
         <label>
             @Html.CheckBoxFor(m => m.Exclude)
             @Html.DisplayNameFor(m => m.Exclude)
         </label>
    </div>
</div>

results matching ""

    No results matching ""