我一直在使用来自Trirand的最新MVC dll,我正在使用JqGrid.Databind()函数从控制器获取数据。这是我写的代码:
var listToBind = gridDataTable.Cast<IDictionary>().ToDataSource();
gridModel.ResourcePlanningGrid.DataSource = null;
JsonResult returnObject;
try
{
returnObject = gridModel.ResourcePlanningGrid.DataBind(listToBind.AsQueryable());
}
catch(Exception ex)
{
//Unknown Exception: delete the current session that holds the grid and
//restart the whole page
this.Session["ResourcePlanningGrid"] = null;
return FilterData();
}
间歇性地在.DataBind()调用上抛出异常,该异常表明它解析的字符串不是有效的布尔值。有没有人遇到过这个?是否有现成的解决方案?或者我应该找到另一种方法将列表中的值传递给绑定?
这是异常堆栈跟踪。
at System.Boolean.Parse(String value)
at System.Convert.ToBoolean(String value)
at Trirand.Web.Mvc.JQGrid.get_AjaxCallBackMode()
at Trirand.Web.Mvc.JQGrid.DataBind()
at Trirand.Web.Mvc.JQGrid.DataBind(Object dataSource)
at Cormant.OrangeReports.Web.Controllers.ResourcePlanningController.FilterData(Nullable`1 customerID, Nullable`1 projectID, Nullable`1 startDate, Nullable`1 endDate, String employeeID) in e:\Projects\OrangeReports\Cormant.OrangeReports.Web\Controllers\ResourcePlanningController.cs:line 175
先谢谢