Hello,
Use TOP function in SQL query to BIND GridView
Make your query to check top records as following way
cmd.CommandType = CommandType.Text;
cmd.CommandText = "select Top " + PageSize + " id,name tablename where id not in (select top (" + PageSize * number + ") id from tablename)";
cmd.Connection = con;
Take two button next and previous to increment/decrement number
switch (e.CommandName)
{
case "Previous":
if (CurrentPage != 0)
{
CurrentPage = CurrentPage - 1;
lblCurrentPage.Text = CurrentPage.ToString();
}
break;
case "Next":
if (GridView2.Rows.Count != 0)
{
CurrentPage = CurrentPage + 1;
lblCurrentPage.Text = CurrentPage.ToString();
}
break;
}
Hope this helpful!
Happy Coding J
Thanks