2
Answers

Gridview pagination is not working??

Vsv Pp

Vsv Pp

9y
596
1
I'm using pagination for my gridview ,I can able to click on next page at first time but second time it's not working but I checked by using break point ,in runtime am getting the pagination in pageindexchanged event.If I check with out break point the pagination is not at all working.Can any one help me how to solve this error.Here is my code
 
In PageLoad :
                      if(!IsPostback)
                       {
                         BindData();
               } 
BindData()
{
 string s="Select *from Tbl_Candidates";
SqlConnection con=new SqlConnection("Here is my connection");
SqlDataAdapter da=new SqlDataAdapter(s,con);
DataSet ds=new DataSet();
da.Fill(ds);
empGrid.DataSource=ds.Tables[0];
empGrid.DataBind(); 
 } 
 
InPageindexChanged :
   empGrid.PageIndex=e.NewPageIndex;
BindData(); 
Answers (2)