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




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

Query/Feedback


Your Email Id  
 
Subject 
 
Query/FeedbackCharacters remaining 250