i want to do sorting in the mvc contrib grid….so far i have i used this coding in
homecontroller.cs
public ActionResult Sort(GridSortOptions Sort)
{
using (ProductsDataContext db = new ProductsDataContext())
{
var categories = db.Products.ToList();
if (Sort.Column != null)
categories =categories.OrderBy(Sort.Column, Sort.Direction);
ViewData["sort"] = Sort;
return View(categories);
}
}
Here i am getting a error:
Cannot implicitly convert type
‘System.Collections.Generic.IEnumerable’
to
‘System.Collections.Generic.List’.
An explicit conversion exists (are you
missing a cast?)
Either change this line:
to this:
Or change this line
to this: