vendredi 13 octobre 2017

How to show checkbox checked/unchecked on the basis of bool variable fetched from database

I am new to ASP MVC development. I wanted to ask that how can i set the check box value to true or false based on the bool variable result? I have tried using the following approach:

     @Html.CheckBoxFor(f => f.SFLandRFListAttached, new {Value = @ViewBag.formfetched.SFLandRFLListAttached})

Like here "@ViewBag.formfetched.SFLandRFLListAttached" returns a bool value, but it doesn't check/uncheck the checkbox. Please help I am new to MVC coding.




Aucun commentaire:

Enregistrer un commentaire