0
sbenfares created
Hi,
I have a DTO & ViewModel with a boolean fields. (MyData)
I'm using a checkbox on my razor view :
<input type="checkbox" id="myCheckBox" name="myCheckBox" value="@Model.MyData" checked="@Model.MyData" />
When i try to call my service :
myService.myMethod($form.serializeFormToObject())
.done(function () {
// Todo notify
});
I have an error which explain me that the serializeFormToObject() method cannot bind checkbox string to bool :
Could not convert string to boolean: value
1 Answer(s)
-
0
Your
input checkbox
name
property should be MyData<input type="checkbox" id="myCheckBox" name="MyData" value="@Model.MyData" checked="@Model.MyData" />