mercredi 15 novembre 2017

Checkbox in MVC 5 ASP.net

I made a "Availability" option in my database, this is set as a "bit". When I made a controller on my generated model, it came out as a dropdownlist with 2 values: true and false. I don't want this to be a dropdown list but a checkbox. I've googled all around and couldnt find an easy fix for this. Any of you have an idea how to do this? My code looks like this:

<div class="form-group">
        @Html.LabelFor(model => model.Beschikbaar, htmlAttributes: new { @class = "control-label col-md-2" })
        <div class="col-md-10">
            <div class="checkbox">
                @Html.EditorFor(model => model.Beschikbaar)
                @Html.ValidationMessageFor(model => model.Beschikbaar, "", new { @class = "text-danger" })
            </div>
        </div>
    </div>




Aucun commentaire:

Enregistrer un commentaire