Reloading grid
Name Surname Marital status Time stamp
Joe Crosswave Married 3/27/2025 9:22:31 AM
Merry Lisel Widowed 3/27/2025 9:22:31 AM
Henry Crux Single 3/27/2025 9:22:31 AM
Cody Jurut 3/27/2025 9:22:31 AM
Simon Scranton Single 3/27/2025 9:22:31 AM
Leena Laurent Divorced 3/27/2025 9:22:31 AM
Ode Cosmides Married 3/27/2025 9:22:31 AM
Diandra Mizner Single 3/27/2025 9:22:31 AM
Pete Cassel Married 3/27/2025 9:22:31 AM
Nicky Tremblay Married 3/27/2025 9:22:31 AM
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());
}