Embedding Grids

« Footer Sorting »
Movie Cast
Name
Star Wars
Movie Director
George Lucas
Movie Genre
Sci-Fi
Released
1997
  • Mark Hamill as Luke Skywalker
  • Harrison Ford as Han Solo
  • Carrie Fisher as Princess Leia Organa
  • Alec Guinness as Ben Obi-Wan Kenobi
  • Anthony Daniels as C-3PO
  • Kenny Baker as R2-D2
  • Peter Mayhew as Chewbacca
  • David Prowse as Darth Vader
Name
Reservoir Dogs
Movie Director
Quentin Tarantino
Movie Genre
Thriller
Released
1992

Embedding a TwoColumnGrid

@(await Html
    .SimpleGrid(Model.Take(2))

    .AddColumn(column => column
        .Header("Movie")
        .Css(css => css.Item.AddStyle("max-width: 330px;"))
        .TwoColumnGrid(model => model))

    .AddColumn(column => column
        .For(movie => movie.Cast)
        .DisplayAsList(movie => movie.Cast))

    .RenderAsync())


Movie
Name
Star Wars
Name
Star Wars
Movie Director
George Lucas
Movie Genre
Sci-Fi
Released
1997
Name
Reservoir Dogs
Name
Reservoir Dogs
Movie Director
Quentin Tarantino
Movie Genre
Thriller
Released
1992

Embedding a TwoColumnGrid (again)

@(await Html
    .SimpleGrid(Model.Take(2))

    .AddColumn(column => column
        .Header("Movie")
        .TwoColumnGrid((movie, builder) =>
        {
            builder.AddRow("Name", movie.Name);

            builder.AddRowsForModel(movie, builder => builder
                .AddRowFor(movie => movie.Name)
                .AddRowFor(movie => movie.Director)
                .AddRowFor(movie => movie.Genre)
                .AddRowFor(movie => movie.Released));
        }))

    .RenderAsync())


Name Released Cast
Star Wars 1997
Name Character
Mark Hamill Luke Skywalker
Harrison Ford Han Solo
Carrie Fisher Princess Leia Organa
Alec Guinness Ben Obi-Wan Kenobi
Anthony Daniels C-3PO
Kenny Baker R2-D2
Peter Mayhew Chewbacca
David Prowse Darth Vader
Reservoir Dogs 1992
Name Character
No matching records.

Embedding a SimpleGrid

@(await Html
    .SimpleGrid(Model.Take(2))
    .AddColumnFor(movie => movie.Name)
    .AddColumnFor(movie => movie.Released)
    .AddColumn(col => col
        .For(movie => movie.Cast)
        .SimpleGrid(
            movie => movie.Cast?.AsQueryable(), 
            grid => grid.AddColumnsForModel()))

    .RenderAsync())