I\'m new to MVC C#.
Here is a ready and working code (the part of the working code).
@foreach (var item in Model)
{
Directly use orderby
@foreach (var item in Model.OrderBy(i => i.Order))
{
<div style="height: 200px; ">
@Html.Raw(@item.Description)
</div>
}
You can use the Linq OrderBy extension method
@foreach (var item in Model.OrderBy(i => i.Order))
{
}
Use OrderBy extension method on IEnumerable in System.Linq namespace
@foreach (var item in Model.OrderBy(i => i.Order))
{
<div style="height: 200px; ">
@Html.Raw(@item.Description)
</div>
}