jeudi 25 mai 2017

input type checkbox always returns false in model in MVC5

Using the standard TextBoxFor helper, the checkbox generates correctly and functions.

@Html.TextBoxFor(m => m.RememberMe, new { type="checkbox", id="login-rememberme", @class="form-control"})
<span></span> Remember Me?

The problem is even when I set the checkbox to true on the page, the model is always returning as false to the controller.

I'm somewhat new to using MVC but I would assume the model value is set just as the other's were (username and password) from their textboxes.




Aucun commentaire:

Enregistrer un commentaire