Preview
MVC controller

[HttpGet]
public ActionResult Index()
{
    if (HttpContext.Request.Headers.XRequestedWith == "XMLHttpRequest")
        return PartialView("_IndexGrid", repository.GetPeople());

    return View();
}

MVC main view

@Html.AjaxGrid(Url.Action("Index"))

_IndexGrid partial view

@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")
    .Pageable(pager =>
    {
        pager.PagesToDisplay = 2;
        pager.RowsPerPage = 2;
    })
    .Filterable()
    .Sortable()
)

Razor pages

public class IndexModel : PageModel
{
    public void OnGet()
    {
    }
}

public class IndexGridModel : PageModel
{
    public IQueryable<Person> People { get; set; }

    public void OnGet()
    {
        People = repository.GetPeople();
    }
}

Index razor page

@page
@model IndexModel

@Html.AjaxGrid(Url.Page("IndexGrid"))

IndexGrid razor page

@page
@model IndexGridModel

@{ Layout = null; }

@* Should only include grid declaration *@

@(Html
    .Grid(Model.People)
    .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")
    .Pageable(pager =>
    {
        pager.PagesToDisplay = 2;
        pager.RowsPerPage = 2;
    })
    .Filterable()
    .Sortable()
)