Skip to content

Instantly share code, notes, and snippets.

@JeremySkinner
Created September 12, 2010 09:03
Show Gist options
  • Select an option

  • Save JeremySkinner/575951 to your computer and use it in GitHub Desktop.

Select an option

Save JeremySkinner/575951 to your computer and use it in GitHub Desktop.
public ActionResult Sorting(GridSortOptions sort)
{
// If there's no sort option specifed, then default to sorting on the Name column.
if(string.IsNullOrEmpty(sort.Column)) {
sort = new GridSortOptions { Column = "Name" };
}
ViewData["sort"] = sort;
var people = _peopleFactory.CreatePeople().OrderBy(sort.Column, sort.Direction);
return View(people);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment