asp.net mvc - C# Order by in foreach -
i'm new mvc c#.
here ready , working code (the part of working code).
@foreach (var item in model) { <div style="height: 200px; "> @html.raw(@item.description) </div> }
the problem description not displayed on page in proper order is. so, order of <div>
s should different.
how modify code works properly?
the order of description
field should ordered order
column.
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> }
Comments
Post a Comment