Session or Viewstate
-
Hi Everybody, I need to store a datatable in my page (To bind a grid again after Sorting To be precised) At present I am storing it in viewstate My question is will it better to store it in session rather than ViewState(As that Datatable is quite big the page may become quite heavy)???
-
Hi Everybody, I need to store a datatable in my page (To bind a grid again after Sorting To be precised) At present I am storing it in viewstate My question is will it better to store it in session rather than ViewState(As that Datatable is quite big the page may become quite heavy)???
Yes, I will suggest you to store data table in Session , rather than View State as you data size is quite big. Any way you can check one of my article on view state Beginner's Guide to View State[^] And don't forget to read Discussion Section [ViewState Vs Session ]
cheers, Abhijit
-
Yes, I will suggest you to store data table in Session , rather than View State as you data size is quite big. Any way you can check one of my article on view state Beginner's Guide to View State[^] And don't forget to read Discussion Section [ViewState Vs Session ]
cheers, Abhijit
hi Abhijit, read the article ... good one thanx
-
Hi Everybody, I need to store a datatable in my page (To bind a grid again after Sorting To be precised) At present I am storing it in viewstate My question is will it better to store it in session rather than ViewState(As that Datatable is quite big the page may become quite heavy)???
Your best bet if it's big is to store the ids needed to build it, on the URL perhaps, and then get the data from the DB as needed. keeping viewstate down is a good thing, but using the session too much is also a bad move.
Christian Graus Driven to the arms of OSX by Vista.
-
Hi Everybody, I need to store a datatable in my page (To bind a grid again after Sorting To be precised) At present I am storing it in viewstate My question is will it better to store it in session rather than ViewState(As that Datatable is quite big the page may become quite heavy)???
Hi Nishant Session v/s Viewstate is quite a good question, but you need to consider two things before you make up your mind. 1. How long you want to retain the DataTable in Memory. i.e. if your site is hosted on shared server then you cannot hold it for more than a 5-10 mins as the services restart and the session is destroyed. So in this case the viewstate is better option. But if you are having dedicated server then opt for session. 2. Why not XML. Create a XML of datatable with unique name, write it to disk and then save the file name in ViewState. You will save both the ViewState and session memory.