Step1:-> Define the pageIndexChanging event of grid view and write the below code.
GridView1.EditIndex = e.NewPageIndex;
Step2:-and Fill the GridView again from data base.
FillGrid();
*********Complete Paging of GridView******************
protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
GridView1.EditIndex = e.NewPageIndex;
FillGrid();
}
protected void FillGrid()
{
SqlCommand cmd = new SqlCommand("select * from employee", Con);
con.Open();
GridView1.DataSource = cmd.ExecuteReader();
GridView1.DataBind();
con.Close();
}
No comments:
Post a Comment