我的代码:
public class MyCustomGridActionResultFactory : IGridActionResultFactory
{
public System.Web.Mvc.ActionResult Create(object model)
{
ResultCache.AdvanceSearchGridResult = model as List<Models.Search.SearchGridModel>;
//return a custom JSON result which have json serializer set to int.MaxValue
return new CustomJsonResult
{
Data = model
};
}
}
结果缓存代码:
public static class ResultCache
{
public static List<Models.Search.SearchGridModel> AdvanceSearchGridResult
{
get { return System.Web.HttpContext.Current.Session["AdvanceSearchGridResult"] as List<Models.Search.SearchGridModel>; }
set { System.Web.HttpContext.Current.Session["AdvanceSearchGridResult"] = value; }
}
}
**
模型作为
List<Models.Search.SearchGridModel>
返回 NULL 值
注意:
ResultCache.AdvanceSearchGridResult = model;
给出错误消息“无法从对象转换为列表”
**。如何解决这个问题。谢谢。