This article shows how to deal with the Sorting Event in GridView.
We will use one GridView and its sorting event, then we write some code in that event for making name ascending and descending.Initial chamber
Step 1
Open your Visual Studio 2010 and create an Empty Website, provide a suitable name (gridviewsorting_demo).Step 2
In Solution Explorer you get your empty website, then add two web forms and a SQL Server Database as in the following.For Web Form:Autocomplete_demo (your empty website) then right-click then select Add New Item -> Web Form. Name it gridviewsorting_demo.aspx.For SQL Server Databasegridviewsorting_demo (your empty website) then right-click then select Add New Item -> SQL Server Database. (Add a database inside the App_Data_folder).DATABASE CHAMBERStep 3
In Server Explorer, click on your database (Database.mdf) then select Tables -> Add New Table. Make the table like this.
Table tbl_data (Don't Forget to make ID as IS Identity -- True)
Design chamberStep 4Now open your gridviewsorting_demo.aspx file, where we create our design for GridView sorting.Gridviewsorting_demo.aspx
Hands on with ASP.Net MVC - Covering MVC 6