Answered by:
Can a website gridview remain functional indefinitely?

Question
-
User-985624828 posted
I have finally completed a web form pilot project that combines the Gridview control with the xmlDataSource control. It reliably displays data in either a single page (eight rows) or multiple pages as required. I have page navigation controls for stepping forward or backward through the pages and a drop down control for going to a specific page. Everything seems to be stable. (You can try it here.)
The only problem is that to get to this point, I had to use values stored in session variables. (Especially important: the xpath value for the XML data currently being displayed.) After a period of inactivity, they go away, the gridview becomes unresponsive, and the user has to start over. Is there a way around this? A way to keep variables preserved as long as the page is open without any timeout considerations? Or even a way to redirect to another page when the variables are about to die?
Wednesday, August 31, 2016 9:54 PM
Answers
-
User-271186128 posted
Hi artsnob,
artsnob
The only problem is that to get to this point, I had to use values stored in session variables. (Especially important: the xpath value for the XML data currently being displayed.) After a period of inactivity, they go away, the gridview becomes unresponsive, and the user has to start over. Is there a way around this? A way to keep variables preserved as long as the page is open without any timeout considerations? Or even a way to redirect to another page when the variables are about to die?As we all known, if the time between requests for a particular session exceeds the specified time-out value in minutes, the session is considered expired.
So, I suggest you could try to use View state, global variable or Application State to store the value, instead of use session.
More details information about sate management, you can check this article: https://msdn.microsoft.com/en-us/library/75x4ha6s.aspx
Best regards,
Dillion- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Thursday, September 1, 2016 7:24 AM
All replies
-
User-271186128 posted
Hi artsnob,
artsnob
The only problem is that to get to this point, I had to use values stored in session variables. (Especially important: the xpath value for the XML data currently being displayed.) After a period of inactivity, they go away, the gridview becomes unresponsive, and the user has to start over. Is there a way around this? A way to keep variables preserved as long as the page is open without any timeout considerations? Or even a way to redirect to another page when the variables are about to die?As we all known, if the time between requests for a particular session exceeds the specified time-out value in minutes, the session is considered expired.
So, I suggest you could try to use View state, global variable or Application State to store the value, instead of use session.
More details information about sate management, you can check this article: https://msdn.microsoft.com/en-us/library/75x4ha6s.aspx
Best regards,
Dillion- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Thursday, September 1, 2016 7:24 AM -
User-985624828 posted
Thanks ... I wish I'd read this article long ago. It definitely looks like application state is the way to go. Do you happen to know of a working gridview anywhere that uses this technique?
Thursday, September 1, 2016 12:21 PM -
User-271186128 posted
Hi artsnob,
Do you happen to know of a working gridview anywhere that uses this technique?Yes, according to your description, I thought we could use View state or global variable to achieve your requirement in the first place, but from that article, I thought we could also use the application state to do that.
Best regards,
DillionFriday, September 2, 2016 2:46 AM -
User-985624828 posted
I did some experimentation with session variables and was able to get the gridview to remain functional longer, but there still comes a point where it no longer works properly. I’m beginning to think that the answer to the question I posed is “no.” There are simply too many internal variables to the control that go south when the session ends. There’s simply no way for a gridview – especially a paged one – to persist beyond a session end. It would be nice if there was an EVENT when a session ends so that you could exit gracefully to another page, but there doesn’t seem to be one.
Wednesday, September 7, 2016 3:23 PM