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
Markdown is supported
Copy & paste or drag & drop images (max 30 MB per image)
1 Answer(s)
-
0
Your
input checkboxnameproperty should be MyData<input type="checkbox" id="myCheckBox" name="MyData" value="@Model.MyData" checked="@Model.MyData" />Markdown is supportedCopy & paste or drag & drop images (max 30 MB per image)