asp.net GridView Sorting

  • Thread starter Thread starter Guest
  • Start date Start date
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
 
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
 
Back
Top