Lets say I render a Checkbox:
@Html.CheckboxFor(x => x.Checked) // Checked is true by default
ASP will turn that as:
<input checked="checked" data-val="true" data-val-required="The field is required." id="Checked" name="Checked" type="checkbox" value="true" />
<input name="Checked" type="hidden" value="false" />
Since ASP outputs two inputs with the same name for a Checkbox, we also get two GET parameters in the URL when submitting the form with the checkbox:
http://...?Checked=true&Checked=false
Lets say I'm also using MvcContrib for displaying a table with sorting.
When I sort a column, MvcContrib is unable to understand the duplicate GET parameters, and instead of writing ?Checked=true&Checked=false
, it writes ?Checked=true%2Cfalse
, which can't be parsed to a bool by MVC3. The error message after sorting is:
String was not recognized as a valid Boolean.
Has anyone else experienced this problem with the MvcContrib grid?