Skip to content

Instantly share code, notes, and snippets.

@JeremySkinner
Created May 21, 2010 06:32
Show Gist options
  • Select an option

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

Select an option

Save JeremySkinner/408539 to your computer and use it in GitHub Desktop.
//Grid Model
public class MyGridModel : GridModel<Person> {
private HtmlHelper _html;
public MyGridModel() {
ColumnFor(x => _html.ActionLink("Whatever"));
}
public MyGridModel Build(HtmlHelper html) {
_html = html;
return this;
}
}
// Controller
public ActionResult Index() {
var model = new MyGridModel();
var people = _peopleFactory.GetPeople();
ViewData["gridModel"] = model;
return View(people);
}
//View
<%= Html.Grid(Model).WithModel(((MyGridModel)ViewData["gridModel"]).Build(Html))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment