views:

94

answers:

4

Am new to asp.net

Here is what I need to do: I've an asp.net page called Results.aspx which has got 8 AJAX collapsible panels and a gridview control binded to database.It also has pagination functionality.

From this page, user can navigate to other pages in the application.When he comes back to Results.aspx,I need to persist states of the following areas: 1.All collapsible panels 2.Gridview control 3.Pagination

What is the most efficient way of achieving this in asp.net other then using asp.net sessions?

+1  A: 

ASP.NET Session is the most efficient way of doing this. You are harnessing a built-in, session-specific, user-specific state manager that is very fast and optimized to do exactly what you want to do. In this particular instance I would suggest that you store the metadata required to persist the user's settings in session (don't use session as a ViewState-replacement into which you cram whole controls). If you use session responsibly then I think you will find it suits your needs.

You could definitely do it other ways but why would you want to?

Andrew Hare
Just make a distinction between storing the hold gridview/panels and storing the details necessary to build the gridview/panels
Joel Coehoorn
Thanks - edited to your point :)
Andrew Hare
A: 

Using ASP.NET session state is about as efficient as you're going to get with this. You can use a custom session state provider if you feel the normal one is wrong for you, but it's pretty much the only way to persist the state of a page when you're on another page.

I suppose the other thing you could do is persist the state in a hidden field, then somehow post that to all the other pages you might possibly use after that.


The ASP.NET Cache object keeps information for the entire application - it is not per-user, so it would be a very bad way to persist per-page-per-user state.

John Saunders
A: 

Session State is the option, but beware how you implement that if you have a Server Farm or you are planning to escale your application.

Regards!!!

MRFerocius
A: 

thanks for all your answers.....can i use asp.net page caching instead of sessions?

Edited my answer to answer you.
John Saunders