I'm a newbie to ASP.Net MVC 4.0 and I'm trying to use Trirand's JQGrid populating data from database. I'm getting the above error when I try to bind the data to JQGrid.
The error is at the below line
return gridModel.MarketPriceAnalysisGrid.DataBind(oMarketPriceAnalysisModel.AsQueryable<MarketPriceAnalysisModel>());
Code below :
// This method is called when the grid requests data
public JsonResult SearchGridDataRequested()
{
// Get both the grid Model and the data Model
var gridModel = new MarketPriceAnalysisJQGridModel();
// customize the default Orders grid model with our custom settings
SetUpMarketPriceAnalysisGrid(gridModel.MarketPriceAnalysisGrid);
var oMarketPriceAnalysisModel = MarketPriceAnalysisRepository.GetListOfSAPSPTComponents();
// return the result of the DataBind method, passing the datasource as a parameter
// jqGrid for ASP.NET MVC automatically takes care of paging, sorting, filtering/searching, etc
return gridModel.MarketPriceAnalysisGrid.DataBind(oMarketPriceAnalysisModel.AsQueryable<MarketPriceAnalysisModel>());
}
The method GetListofSAPSPTComponents returns an IEnumerable
IEnumerable<MarketPriceAnalysisModel> GetListOfSAPSPTComponents();
I just figured that the error source is Trirand.Web.MVC and the stack trace says
`at Trirand.Web.Mvc.Util.PrepareJsonResponse(JsonResponse response, JQGrid grid, DataTable dt)
at Trirand.Web.Mvc.Util.ConvertToJson(JsonResponse response, JQGrid grid, DataTable dt)
at Trirand.Web.Mvc.JQGrid.FilterDataSource(Object dataSource, NameValueCollection queryString, IQueryable& iqueryable)
at Trirand.Web.Mvc.JQGrid.GetJsonResponse()
at Trirand.Web.Mvc.JQGrid.DataBind()
at Trirand.Web.Mvc.JQGrid.DataBind(Object dataSource)
at MedPackMVC.Controllers.MarketPriceAnalysisController.SearchGridDataRequested() in c:\Work\04_Dev\MedPackMVCApplication\MedPackMVC\Controllers\MarketPriceAnalysisController.cs:line 95
`
Not sure what could be the possible cause for this? Thanks