I am using bootstrap-toggle along with the Html.CheckBoxFor() helper in a view like so:
@Html.CheckBoxFor(m => m.issueFlag,
new { id = "toggle-switch",
data_toggle = "toggle",
data_size = "normal",
data_on = "Issue on Invoice",
data_off = "No Issue on Invoice",
data_onstyle="danger",
data_offstyle="success",
data_width = "200" })
The switch appears and functions on the front end as expected, but when the form is submitted the value is always false. Other things in the form such as check boxes, drop downs and text boxes are captured correctly in the controller. The POST action in the controller is declared like:
[HttpPost]
[AuthorizeRights(Rights = "Viper_ViewAudit,Viper_EditAudit")]
public ActionResult ShowImage(PDFViewer pdfViewerModel, string Command)
{
... content ...
}
Am I doing something wrong somewhere? Why is m.issueFlag always false?
(I will provide more code needed, I am not sure what else is relevant).
Aucun commentaire:
Enregistrer un commentaire