[HttpGet]
public ViewResult Index()
{
// Only browser url query values will be visible here.
return View();
}
[HttpGet]
public PartialViewResult IndexGrid()
{
// Only grid query values will be available here.
return PartialView("_IndexGrid", repository.GetPeople());
}
@Html.AjaxGrid(Url.Action("IndexGrid"))
// or with html attributes
@Html.AjaxGrid(Url.Action("IndexGrid"), new { id = "my-ajax-grid"})
@model IQueryable<Person>
@* Should only include grid declaration *@
@(Html
.Grid(Model)
.Build(columns =>
{
columns.Add(model => model.Name).Titled("Name");
columns.Add(model => model.Surname).Titled("Surname");
columns.Add(model => model.MaritalStatus).Titled("Marital status");
columns.Add(model => model.Age).Titled("Age");
columns.Add(model => model.Birthday).Titled("Birthday").Formatted("{0:d}");
columns.Add(model => model.IsWorking).Titled("Employed");
})
.Empty("No data found")
.Id("my-ajax-grid")
.Pageable(pager =>
{
pager.PagesToDisplay = 2;
pager.RowsPerPage = 2;
})
.Filterable()
.Sortable()
)