大家好,我正在使用 MvcJqGrid(https://github.com/robinvanderknaap/MvcJqGrid)在我的项目中显示我的数据。我正在尝试通过 jquery post 传递当前的 jqgrid 设置,但我无法在动作控制器中获取它。看来我缺少 GridModelBinder 的东西。你能告诉我我在这里做错了什么..谢谢
这是我的 JavaScript 代码:
function Export() {
var data = $("#ReportGrid").getGridParam("postData");
$.post('/Home/ExporttoExcel', { gridSettings: data, moduleID: 3 });
}
这是我的动作控制器:
public FileContentResult ExporttoExcel(GridSettings gridSettings, Int32 moduleID = 0)
{
///Do something with the gridsettings value here.
var encoding = new ASCIIEncoding();
var fileContent = encoding.GetBytes(file.ToString());
return File(fileContent, "application/ms-excel", "List.xls");
}