I am very much new to the asp.net mvc. I am trying to work on webgrid server side paging but i am facing an error while binding the webgrid. I am attaching the error snap. Following are the codes:
Controller:
public ActionResult WebGrid(int page=1,string sort = "", string sortdir = "", string search = ""){
var list = new List(); int DisplayLength = 10;int DisplayStart = (page * DisplayLength) - DisplayLength;list = pad.GetPrdListInChunks_1(DisplayLength, DisplayStart, sort, sortdir);ViewBag.TotalRows = list[0].TotalCount;ViewBag.Search = search;return View(list);
}
View:
@model List@{
Layout = "~/Views/Shared/_Layout.cshtml";WebGrid grid = new WebGrid(canPage: true, rowsPerPage: 10);grid.Bind(Model, rowCount: ViewBag.TotalRows, autoSortAndPage: false);
}
Error:
Srikant MaruwadaPosted Feb 12, 2018, 1:46 AM