开发者

Sorting in GridView

开发者_StackOverflow社区Could any one let me know how to implement sorting on GridView?


I've just had a look at some code I wrote a while ago that allows sorting on an <asp:GridView> and it would appear all I did was added AllowSorting="True" to the GridView tag and then SortExpresssion="expression" to the Column, for example:

<asp:TemplateField HeaderText="Status" ItemStyle-HorizontalAlign="Center" SortExpression="StatusId">
    <HeaderStyle BorderColor="#1A3491" Width="130px"></HeaderStyle>
    <ItemStyle Height="20px" HorizontalAlign="Center"></ItemStyle>
    <ItemTemplate>
        <%# (int)Eval("StatusId") %>
    </ItemTemplate>
</asp:TemplateField>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜