Because You Used Datareader which works in forward only manner.<br />
Use Dataset or Datatable[Dataadpter] which supports both forward and backward navigation.
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
Binddata();
}
}
public void Binddata()
{
string connect=System.Configuration.ConfigurationManager.ConnectionStrings["conn"].ConnectionString;
SqlConnection sqlconn = new SqlConnection(connect);
SqlDataAdapter da = new SqlDataAdapter("select * from persons",sqlconn);
DataSet ds = new DataSet();
da.Fill(ds);
sqlconn.Open();
GridView1.DataSource = ds.Tables[0];
GridView1.DataBind();
sqlconn.Close();
}
protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
GridView1.PageIndex = e.NewPageIndex;
Binddata();
}