asp.net GridView Sorting

G

Guest

Hi,

I have GridView:
<asp:GridView ID="gv" runat="server" AutoGenerateColumns="False"
AllowSorting="True" onsorting="gv_Sorting" ><Columns>
<asp:BoundField DataField="Id" HeaderText="Id" SortExpression="id" />
<asp:BoundField DataField="Name" HeaderText="Name" SortExpression="name"
/></Columns>
</asp:GridView>

I can sort by colums. But I would like user to see which column is curent
sorted by and if it is ASC or DESC.
Have do I do it by hand in onsorting event ? (change cell style, and arrow
gif)

Thanks for help
 
L

Lee

Hi,

I have GridView:
<asp:GridView ID="gv" runat="server" AutoGenerateColumns="False"
AllowSorting="True" onsorting="gv_Sorting"  ><Columns>
    <asp:BoundField DataField="Id" HeaderText="Id" SortExpression="id" />
    <asp:BoundField DataField="Name" HeaderText="Name" SortExpression="name"
/></Columns>
</asp:GridView>

I can sort by colums. But I would like user to see which column is curent
sorted by and if it is ASC or DESC.
Have do I do it by hand in onsorting event ? (change cell style, and arrow
gif)

Thanks for help

A great article detailing exactly how to do this is on CodeProject:
http://www.codeproject.com/KB/aspnet/Gridview_Sorting_Paging.aspx

L. Lee Saunders
oldschooldotnet.blogspot.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top