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

Popular posts from this blog

python - Subclassed QStyledItemDelegate ignores Stylesheet -

java - HttpClient 3.1 Connection pooling vs HttpClient 4.3.2 -

SQL: Divide the sum of values in one table with the count of rows in another -