【发布时间】:2014-05-26 17:48:29
【问题描述】:
我为我的 GridView 使用模型绑定,并使用 SortExpression 自动对其进行排序。但我遇到了这个问题。当我有一个 1 级排序表达式 (Id) 时它工作正常,但是当我想使用 2 级表达式 (Address.City) 时没有任何反应。 示例:
<asp:TemplateField HeaderText="City" SortExpression="Address.City">
<ItemTemplate>
<asp:Label ID="lblCity" runat="server"><%# Eval("Address.City")%></asp:Label>
</ItemTemplate>
</asp:TemplateField>
那么,如何通过 2 级对象属性对 GridView 进行排序?
谢谢!
【问题讨论】:
标签: c# asp.net sorting gridview model-binding