I am trying to associate a label to a checkbox using Razor helpers:
<div class="checkbox">
<label>@Html.CheckBox("MyLabel", true) @Html.DisplayName("Check/UnCheck this")</label>
</div>
similar as explained here in the answer by @Jess.
Label and checkbox is displayed correctly in the view. My question is, in this scenario, when using Razor helper Html.CheckBox (Not Html.CheckBoxFor), is it the correct way to associate the label to the checkbox?
Aucun commentaire:
Enregistrer un commentaire