Sorting the Data in Grid view Manually.
Session["SortTable"] = table; //From Which table data you are going to bind in gridview keep that table data in session. protected void gvtest_Sorting1(object sender, GridViewSortEventArgs e) { try { GridView grid = (GridView)sender; ViewState["sortexpression"] = e.SortExpression; if (ViewState["sortdirection"] == null) { ViewState["sortdirection"] = "asc"; } else ...