title: How to do sorting in mvc contrib grid
body: <p>i want to do sorting in the mvc contrib grid....so far i have i used this coding in </p>
  
  <p>homecontroller.cs</p>
  
  <pre><code>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);
  
          }
  
      }
  </code></pre>
  
  <p>Here i am getting a error:</p>
  
  <blockquote>
    <p>Cannot implicitly convert type
    'System.Collections.Generic.IEnumerable'
    to
    'System.Collections.Generic.List'.
    An explicit conversion exists (are you
    missing a cast?)</p>
  </blockquote>