how can I do multiple sort in
return (from p in _db.Pages where p.int_PostStatusId == 2 select p).OrderByDescending(m => m.int_SortOrder);
i want to do order by by int_PageId as well? first by int_SortOrder then by int_PageId
Use either ThenBy
or ThenByDescending
to order the result of an OrderBy
or OrderByDescending
:
return (...)
.OrderByDescending(m => m.int_SortOrder)
.ThenBy(m => m.int_PageId);
Or using the query syntax:
orderby p.int_SortOrder descending, p.int_PageId
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With