Reloading grid
Name Surname Marital status Time stamp
Joe Crosswave Married 4/19/2025 11:01:36 PM
Merry Lisel Widowed 4/19/2025 11:01:36 PM
Henry Crux Single 4/19/2025 11:01:36 PM
Cody Jurut 4/19/2025 11:01:36 PM
Simon Scranton Single 4/19/2025 11:01:36 PM
Leena Laurent Divorced 4/19/2025 11:01:36 PM
Ode Cosmides Married 4/19/2025 11:01:36 PM
Diandra Mizner Single 4/19/2025 11:01:36 PM
Pete Cassel Married 4/19/2025 11:01:36 PM
Nicky Tremblay Married 4/19/2025 11:01:36 PM
Main view

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

_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 => DateTime.Now).Titled("Time stamp");
    })
)

Javascript

document.getElementById('ContentRefresh').addEventListener('click', function () {
    new MvcGrid(document.querySelector('.mvc-grid')).reload();
});

Controller

[HttpGet]
public ViewResult Index()
{
    return View();
}

[HttpGet]
public PartialViewResult IndexGrid()
{
    return PartialView("_IndexGrid", repository.GetPeople());
}