Articles → ASP .NET GRIDVIEW → Sorting in asp.net gridview
Sorting in asp.net gridview
Click to Enlarge
Bind gridview with data
<asp:GridView ID="gvTest" runat="server" DataSourceID="dsTest" >
</asp:GridView>
<asp:SqlDataSource ConnectionString="conn_string" ID="dsTest"
SelectCommand="Select * from Member" runat="server" />
Add property for sorting
<asp:GridView ID=”gvTest” runat=”server” DataSourceID=”dsTest" AllowSorting="true">
</asp:GridView>
<asp:SqlDataSource ConnectionString="conn_string" ID="dsTest"
SelectCommand="Select * from Member" runat="server" />
Output
Click to Enlarge