lundi 20 avril 2015

Make Html.CheckBoxFor return an integer

I want to bind a checkbox to an integer (the ISACTIVE value shown below) in ASP.net MVC.

@Html.CheckBoxFor(model => model.ISACTIVE, new { htmlAttributes = new { @class = "form-control" } })

I know that Html.CheckBoxFor only accepts bool as input and I could add a new property on my Model, but I'm using an already existing database and every time it updates, the Model gets refreshed.

Is there a way to create a new method for CheckBoxFor that would return an integer based on if the box is checked or not?




Aucun commentaire:

Enregistrer un commentaire