Forums - C# Corner

Forum guidelines
Muhammed Afzaal

Muhammed Afzaal

  • 1.6k
  • 1
  • 246

WebGrid Bind Error in MVC

Feb 9 2018 2:59 PM

I am very much new to the 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:

public ActionResult WebGrid(int page=1,string sort = "", string sortdir = "", string search = "")
var list = new List<Product>();
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);
@model List<NorthwindApplication.Models.Product>
Layout = "~/Views/Shared/_Layout.cshtml";
WebGrid grid = new WebGrid(canPage: true, rowsPerPage: 10);
grid.Bind(Model, rowCount: ViewBag.TotalRows, autoSortAndPage: false);

The best overloaded method match for 'System.Web.Helpers.WebGrid.Bind(System.Collections.Generic.IEnumerable<object>, System.Collections.Generic.IEnumerable<string>, bool, int)' has some invalid arguments


Answers (1)


Build smarter apps with Machine Learning, Bots, Cognitive Services - Start free.

Start Learning Now