This question is locked. New answers and comments are not allowed.
Hi,
I have tried to implement paging manually, following the Custom Server Binding example for the Grid control. It has been unsuccessful.
The first load populates the grid without a problem. If I click a page number in the footer, it throws an exception:
The view 'CustomServerBinding' or its master was not found or no view engine supports the searched locations. The following locations were searched:
~/Views/SalesGrid/CustomServerBinding.aspx
~/Views/SalesGrid/CustomServerBinding.ascx
~/Views/Shared/CustomServerBinding.aspx
~/Views/Shared/CustomServerBinding.ascx
~/Views/SalesGrid/CustomServerBinding.cshtml
~/Views/SalesGrid/CustomServerBinding.vbhtml
~/Views/Shared/CustomServerBinding.cshtml
~/Views/Shared/CustomServerBinding.vbhtml
My code is as follows:
The Controller:
The View:
Some guidance would be appreciated greatly.
Cheers
I have tried to implement paging manually, following the Custom Server Binding example for the Grid control. It has been unsuccessful.
The first load populates the grid without a problem. If I click a page number in the footer, it throws an exception:
The view 'CustomServerBinding' or its master was not found or no view engine supports the searched locations. The following locations were searched:
~/Views/SalesGrid/CustomServerBinding.aspx
~/Views/SalesGrid/CustomServerBinding.ascx
~/Views/Shared/CustomServerBinding.aspx
~/Views/Shared/CustomServerBinding.ascx
~/Views/SalesGrid/CustomServerBinding.cshtml
~/Views/SalesGrid/CustomServerBinding.vbhtml
~/Views/Shared/CustomServerBinding.cshtml
~/Views/Shared/CustomServerBinding.vbhtml
My code is as follows:
The Controller:
public class SalesGridController : Controller { private AdventureWorksLT2008Entities db = new AdventureWorksLT2008Entities(); // // GET: /SalesGrid/ public ViewResult Index() { ViewData["total"] = db.SalesOrderHeader.ToList().Count; return View(db.SalesOrderHeader.ToList()); } [GridAction(GridName = "Grid")] public ActionResult CustomServerBinding(GridCommand command) { IEnumerable data = GetServerData(!IsEmptyCommand(command) ? command : new GridCommand()); return View(data); } private IEnumerable GetServerData(GridCommand command) { IQueryable<SalesOrderHeader> query = from s in db.SalesOrderHeader.Include(sod => sod.SalesOrderDetail) select s; query.ApplyFiltering(command.FilterDescriptors); ViewData["total"] = query.Count<SalesOrderHeader>(); query.ApplyPaging(command.Page, command.PageSize); return query.ToList<SalesOrderHeader>(); }etc.The View:
@model IEnumerable<EFAdvWorks.SalesOrderHeader>@{ ViewBag.Title = "Index";}<h2>Index</h2>@(Html.Telerik().Grid<EFAdvWorks.SalesOrderHeader>() .Name("grid") .BindTo(Model) .Columns(columns => { columns.Bound(s => s.SalesOrderID).Width(200); columns.Bound(s => s.ShipDate).Format("{0:dd/MM/yyyy}").Width(200); }) .DataBinding(dataBinding => dataBinding.Server().Select("CustomServerBinding", "SalesGrid")) .Pageable(settings => settings.Total((int)ViewData["total"])) .EnableCustomBinding(true) .Filterable())Some guidance would be appreciated greatly.
Cheers