You may have rebind the original data source when you turn the page. You can do this.
1. define a viewstate ["cached data"] on the page;
2. in PageLoad! When IsPostBack, give the first source to this ViewState ["cached data"], and then set the GridView DataSource to ViewState ["cached data"].
3. When clicking the query, assign the queried data to ViewState ["cached data"],
that's all.
then write
GridView. datasource = viewstate ["cached data"] in the paginated code;
GridView.PageIndex = e.NewPageIndex;
GridView.DataBind();
If there is a lot of data, putting it in ViewState will slow down the page loading, and putting it in Session will be better. You can call me if you don't understand.