Below is the sample to include Sorting and Paging in ASP.Net GridView. ASPX Code <asp:GridView ID="grd" runat="server" AutoGenerateColumns="False" AllowSorting="true" OnSorting="grd_Sorting" AllowPaging="true" PageSize="50" OnPageIndexChanging="grd_PageIndexChanging"> Code Behind protected void grd_Sorting(object sender, GridViewSortEventArgs e) { try { mDT = GetData(); SetSortDirection(SortDirection); if (mDT != null) { mDT.DefaultView.Sort = e.SortExpression + " " + _sortDirection; grd.DataSource = mDT; grd.DataBind(); […]