Form2

« Form Extensions »
Movie Movie Director Edit Director
Star Wars George Lucas
Reservoir Dogs Quentin Tarantino
Airplane! David and Jerry Zucker and Jim Abrahams
Terminator James Cameron
Terminator 2: Judgement Day James Cameron

View

<form method="post">
    @(await Html
        .SimpleGrid(Model.Take(5))

        .AddColumn(col => col
            .DisplayAs(movie =>
                $"<input type='hidden' name='Movies.Index' value='{movie.Name}'>" +
                $"<input type='hidden' name='Movies[{movie.Name}].Name' value='{movie.Name}'>" +
                $"{movie.Name}")
            .Header("Movie")
            .Encoded(false))

        .AddColumnFor(movie => movie.Director)

        .AddColumn(col => col
            .DisplayAs(movie => 
                $"<input class='form-control' type='text' name='Movies[{movie.Name}].Director' value='{movie.Director}' />")
            .Header("Edit Director")
            .Encoded(false))

        // This works as well:
        //.AddColumn(col => col
        //    .DisplayHtmlContent(movie => 
        //        Html.TextBox($"Movies[{movie.Name}].Director", $"{movie.Director}", new { @class = "form-control" })))

        .RenderAsync())
    <button class="btn btn-primary">Submit</button>
</form>

Controller

[HttpGet]
public IActionResult Form2()
{
    return View(MovieQuery);
}

[HttpPost, ValidateAntiForgeryToken]
public IActionResult Form2(Movie[] movies)
{
    return View(movies.AsQueryable())
        .Success($"Received: {movies.Length} movies");
}