jeudi 22 février 2018

ASP.Net MVC : Html Check box always getting false on form after submit

I am using the MVC tightly couple Html Checkboxfor , but its getting always false in my model after form post and the property is bool type.

View:

<div class="col-md-4">
        <label class="mar-t-8">KMAdministration</label>
        <div class="border-box">
            <div class="custom-checkbox mar-b-10">
                @Html.CheckBoxFor(x => x.IsKMAdministrationDone)

            </div>
        </div>  
    </div>

Controller:

    public ActionResult SaveData(ParametersModel model)
    {
     // always getting false here...
     bool val=model.IsKMAdministrationDone;
    }




Aucun commentaire:

Enregistrer un commentaire