0
我使用Web API將Kendo Grid與MVC服務器端封裝器一起設置。這是我的代碼使用Web API的Kendo Grid MVC服務器端封裝器2
@(Html.Kendo().Grid<Models.UserViewModel>()
.Name("UserGrid")
.Columns(column =>
{
column.Bound(c => c.FirstName);
column.Bound(c => c.LastName);
column.Bound(c => c.Email);
})
.DataSource(ds => ds
.Ajax()
.Model(m => m.Id(u => u.Id))
.Read(read => read.Url("/api/..").Type(HttpVerbs.Get))
)
)
這是我的web api控制器和我發現它的問題是我得到null是請求參數。我不知道爲什麼它正在發生,任何suggestionj請
public DataSourceResult GetAllUsers
([ModelBinder(typeof(DataSourceRequestModelBinder))] DataSourceRequest request)
{
var users= _userRepository.GetAllUsers();
return users.ToDataSourceResult(request, s => new UserViewModel
{
Id = s.Id,
FirstName = s.FirstName,
LastName = s.LastName,
Email = s.Email
});
}