$("#Upload-grid").kendoGrid({
dataSource: {
type: "json",
transport: {
read: {
url: "@Html.Raw(Url.Action("FillUploadGride", "Banner"))",
type: "POST",
dataType: "json",
data: { Ids: @Html.Raw(Json.Encode(Model.BannerIds)) }
}
},
public JsonResult FillUploadGride(DataSourceRequest command,List<int> Ids)
{
var gridModel = new DataSourceResult();
var data = _bannerService.GetAllBanner(command.Page - 1, command.PageSize);
var query = (from x in data
select new
{
x.Id,
x.PictureId,
Image = GetUrl(_pictureService.GetPictureUrl(_pictureService.GetPictureById(x.PictureId.Value))),
x.Title,
}
);
gridModel.Data = query;
gridModel.Total = query.Count();
return Json(gridModel, JsonRequestBehavior.AllowGet);
}
dataSource: {
type: "json",
transport: {
read: {
url: "@Html.Raw(Url.Action("FillUploadGride", "Banner"))",
type: "POST",
dataType: "json",
data: { Ids: @Html.Raw(Json.Encode(Model.BannerIds)) }
}
},
public JsonResult FillUploadGride(DataSourceRequest command,List<int> Ids)
{
var gridModel = new DataSourceResult();
var data = _bannerService.GetAllBanner(command.Page - 1, command.PageSize);
var query = (from x in data
select new
{
x.Id,
x.PictureId,
Image = GetUrl(_pictureService.GetPictureUrl(_pictureService.GetPictureById(x.PictureId.Value))),
x.Title,
}
);
gridModel.Data = query;
gridModel.Total = query.Count();
return Json(gridModel, JsonRequestBehavior.AllowGet);
}
No comments:
Post a Comment