【发布时间】:2011-12-31 03:53:12
【问题描述】:
我的页面上有一个复选框,是这样创建的:
@Html.CheckBoxFor(x => x.MyBoolValue)
下面我有一个带有排序和分页的 WebGrid,但是这样做我得到一个 System.InvalidOperationException:
The parameter conversion from type 'System.String' to type 'System.Boolean' failed. See the inner exception for more information.
内部异常是:
{"true,false is not a valid value for Boolean."}
我知道这是由于 CheckBox 和底层 Hidden 值的绑定。在 GET 页面上,我在查询字符串值上使用 Contains("true") 来处理这个问题,但是在刷新 WebGrid 时如何执行此操作?
【问题讨论】:
标签: asp.net-mvc-3 checkbox webgrid