我正面临 mvc telerik grid 的问题,我的观点是:
@(Html.Telerik().Grid(Model.EmployeeList)
.Name("EmployeeGrid")
.Columns(colums =>
{
colums.Bound(e => e.First_Name);
colums.Bound(e => e.Last_Name);
colums.Bound(e => e.Hire_Date);
colums.Bound(e => e.Home_Phone);
})
.DataBinding(dataBinding => dataBinding.Ajax().Select("_AjaxBinding", "Home"))
.Groupable()
.Sortable()
.Pageable(paging=>paging.PageSize(10))
.Filterable()
)
还有我的控制器代码
[AcceptVerbs(HttpVerbs.Post)]
[GridAction]
public ActionResult _AjaxBinding(GridCommand command)
{
using (var contax=new NorthwindEntities()){
int pagesize=command.PageSize;
int page=command.Page;
var EmployeeList = (from items in contax.Employees
select new
{
items.First_Name,
items.Last_Name,
items.Hire_Date,
items.Home_Phone
});
return View(new GridModel
{
Data = EmployeeList
});
}
}
加载时数据已从数据库正确加载,但当我单击分页或排序数据时发生内部服务器错误 500。
提前致谢。