Order Columns
Movie Director | Name | Movie Genre | Released |
---|---|---|---|
George Lucas | Star Wars | Sci-Fi | 1997 |
Quentin Tarantino | Reservoir Dogs | Thriller | 1992 |
David and Jerry Zucker and Jim Abrahams | Airplane! | Slapstick | 1980 |
Grid
@(await Html
.SimpleGrid(Model.Take(3))
.AddColumnsForModel()
.OrderColumns()
.RenderAsync())
Model
public class Movie
{
[Display(Order = 2)]
public string Name { get; set; }
[Display(Name = "Movie Director", Order = 1)]
public string Director { get; set; }
[DisplayName("Movie Genre")]
public string Genre { get; set; }
[Display(AutoGenerateField = true)]
public int? Released { get; set; }
[Display(AutoGenerateField = false)]
public ICollection Cast { get; set; }
}
Note that OrderColumns()
only works on Columns added via AddColumnsForModel()
.
Columns that are added manually are not re-ordered.