C# – GridView – Custom Paging in ASP .NET 2.0 with Microsoft SQL Server 2005 using ROW_NUMBER() and VirtualItemCount

Add a datagrid to your aspx page. Set the following properties in the designer: AutoGenerateColumns="false"         AllowPaging="true"         AllowCustomPaging="true"         AllowSorting="false" <asp:DataGrid         ID="dg"         AutoGenerateColumns="false"         AllowPaging="true"         AllowCustomPaging="true"         AllowSorting="false"         DataKeyField="Id"