vendredi 17 mars 2017

How to set checkbox selected using two lists MVC

I have multiple checkboxes binded from ViewBag list. I have used this pattern while Add Record. But now I have situation of Edit . I have saved the selected checkbox IDs in different table. Now in Edit,how I can make them selected as per user selection done while adding that record?

@foreach (var item in ViewBag.Features)
{
    <div class="form-group form-animate-checkbox col-md-4 col-sm-12">
        <input type="checkbox" class="checkbox Amenities" value="@item.ID" name="@item.Name">
        <label class="lblamenities">@item.Name</label>
    </div>
}




Aucun commentaire:

Enregistrer un commentaire