<asp:gridview id="GridView1" runat="server" backcolor="White" showfooter="false" xmlns:asp="#unknown">
AutoGenerateColumns="False" PageSize="5"
OnPageIndexChanging="GridView1_PageIndexChanging" AllowPaging="True" OnRowCreated="GridView1_RowCreated" PagerSettings-Position="TopAndBottom" PagerStyle-HorizontalAlign="Left" PagerStyle-Wrap="true" BorderColor="#CCCCCC" BorderStyle="None" BorderWidth="1px" CellPadding="3" Width="100%" GridLines="Both">
<alternatingrowstyle backcolor="AliceBlue" />
<pagerstyle horizontalalign="Center" backcolor="White"></pagerstyle>
<pagersettings position="TopAndBottom" firstpagetext="First" lastpagetext="Last">
Mode="NumericFirstLast" ></pagersettings>
<rowstyle forecolor="#000066" horizontalalign="Center" />
<columns></columns>
</asp:gridview>
protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
GridView1.PageIndex = e.NewPageIndex;
BindGrid();
}
public void BindGrid()
{
sqlcommand cmd=new sqlcommand("select * from tblname",sqlconnection);
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataSet ds=new DataSet();
da.Fill(ds);
GridView1.DataSource=ds;
GridView1.DataBind();
}