Click here to Skip to main content
15,942,964 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Dear Friends,

Have a good Day !!

am working on,c#,sqlserver 2005.

on my webpage i had a gridview with paging included in it.

my gridview will refresh for every 30 seconds and data will update in updating is fine.
I have used script manager, update panel, timer control to update the data...
I gave Timer - Interval as 30 seconds....its fine.

But the problem is..........? ?

In Gridview when i click further pages. after 30 seconds its coming to first page.

For Example If i click 3rd page...if i stay 30 seconds in that 3rd page. again its coming back to first page after 30 seconds.

So please help me, how to stay on that particular page even gridview refreshes for after 30 secs.

Please help me, Thanks in advance.

1 solution

You need to store (may be session or hidden variable) the page number last visited and after a refresh, you need to reset the gridview to that page number.
30 seconds is too less a window and with such feature, it would be irritating to navigate through pages.

For such application where refresh happens every 30 sec or so, I would suggest to show everything on single page without pagination (assuming you dont have too many data to display. If you have then making a 30 sec refresh does not make much sense. Use will get confused.)
Share this answer

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