Articles → ASP .NET GRIDVIEW → Sorting In Asp.Net Gridview

Sorting In Asp.Net Gridview





Picture showing the sample database table with data

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




Picture showing the output of Sorting in asp.net gridview

Click to Enlarge




Posted By  -  Karan Gupta
 
Posted On  -  Friday, May 29, 2015

Query/Feedback


Your Email Id  
 
Subject 
 
Query/FeedbackCharacters remaining 250