Can I define Default Sort order in LinQ

后端 未结 1 2039
小蘑菇
小蘑菇 2021-01-29 01:16

If I have a nested ListView, and I\'m calling a related table in LinQ, how do I sort it, without resorting to the ItemDataBound event of the parent?

Pseudo Code (UPDATED

相关标签:
1条回答
  • 2021-01-29 01:43

    My assumption is that Products is an IEnumerable<Product> (or IQueryable). If that is the case, why not just add the OrderBy method to the evaluation, like so:

    <%# Eval("Products.OrderBy(p => p.FieldToSortOn)") %>
    
    0 讨论(0)
提交回复
热议问题