【发布时间】:2010-05-04 10:41:32
【问题描述】:
我正在使用 jquery getJSON 和 asp.net mvc 控制器......我无法让它工作......
public JsonResult GetMaterials(int currentPage,int pageSize)
{
var materials = consRepository.FindAllMaterials().AsQueryable();
var results = new PagedList<MaterialsObj>(materials, currentPage-1, pageSize);
return Json(results);
}
我打电话给这个,
$.getJSON('Materials/GetMaterials', "{'currentPage':1,'pageSize':5}",
function(data) {
});
这个调用似乎不起作用....
通过萤火虫检查时我发现了这个,
The parameters dictionary contains a null entry for parameter
'currentPage' of non-nullable type 'System.Int32' for method
'System.Web.Mvc.JsonResult GetMaterials(Int32, Int32)' in
'CrMVC.Controllers.MaterialsController'. To make a parameter optional its type
should be either a reference type or a Nullable type.<br>
Parameter name: parameters
【问题讨论】:
标签: jquery asp.net-mvc controller getjson