Reputation: 693
I have this partial that lists comments out but that looks like this:
As you can see, some of these dates are out of order...
is there a way to order by date inside this razor for each?
<tbody>
@foreach (var row in Model.*******.******.Where(d => d.Internal_Note == false))
{
<tr>
<td>
@row.Note
</td>
<td>
@row.NoteDT
</td>
</tr>
}
</tbody>
Can I just do something like...
<tbody>
@foreach (var row in Model.GovernmentGroupApplication.tbl_AppStatusGvtGroup_Note.Where(d => d.Internal_Note == false).OrderBy(d=>model.Date) <--- pseudocode.
{
<tr>
<td>
@row.Note
</td>
<td>
@row.NoteDT
</td>
</tr>
}
</tbody>
Upvotes: 0
Views: 421
Reputation: 2504
You're correct with OrderBy()
, it's just your reference to the date field where you're wrong.
@foreach (var row in Model.GovernmentGroupApplication.tbl_AppStatusGvtGroup_Note.Where(d => d.Internal_Note == false).OrderBy(d=>d.Date))
Upvotes: 2