Click here to Skip to main content
15,078,424 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi ,
I am using gridview for displaying data according to search.
eg.:
gridsearch()
{
   //in this i wrote code for searching using userid or username or date
} 


i bind the data in button click. Then I wrote Pageindexchanging:
GridView1_pageindexchangind()
{
  GridView1.PageIndex=e.NewPageIndex;
  gridsearch();
  GridView1.DataBind();
}
// what my problem is, when i search with userid=4766 it displays the users with the userid in 4 pages of gridview.

But when I click 2nd page it binds complete database. Only first page displays my search details
but 2nd page onwards it binds all the data in the database.

Please give a solution on this.
Posted
Updated 26-Jan-11 3:12am
v3

1 solution

The problem is that when you are changing the page, you are binding with all the datasource. This means that when you change the page, you must bind with your search result.
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900