Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Jan 28, 2013 05:41 AM by CruzerB
Jan 27, 2013 06:05 PM|LINK
I have three type of Searches in my site
1. ShowAll Record
2. Advance Search (filtered record by 5-6 textboxes)
3. Basic Search (filtered record by 1 textbox)
.. in EverySearch I m storing the output into viewstate
If user satisfy with Search Result he can download the Data from ViewState (Export into excel feature)
Everything was goes fine but today I started receiving Error "Connection was Reset" and when i checked that sql query was returning 30k records and these 30k recrods stored into viewstate... when I commented the viewstate line .. site started work fine again
is dere any limitation for viewstate ??
if yes, what wil be the best practice to achive above goal
Jan 27, 2013 09:54 PM|LINK
That's a very large amount of data to store in the viewstate. It depends upon the client's connection. The connection could technically timeout with that number of rows because they all have to be transmitted to the client, then back down to the server again
whenever a postback occurs. Normally for performance in displaying records, data paging would be recommended because it is highly efficient and returns the least amount of information from a database at a time. Export usually just makes the call to the database
without paging in order to return the results. Storing them into the ViewState may be causing extra work for the server instead of increasing performance.
Technically though, there is no limit except what bandwidth would allow for the number of records and viewstate size.
Jan 28, 2013 03:44 AM|LINK
As far as i am aware, there is no maximum size for viewstate. I guess that you can store your search result in a session rather than viewstate. larger Viewstate can reduce the page performance.
Jan 28, 2013 05:41 AM|LINK
Large ViewState object will increase the traffic between server and client(Browser). So using
Session will be better. But if you can keep the search condition in
Session object, when user want it to be exported then only the system process and query the data according to the search condition will truely reduce the server payload for the large session object.
Anyways, it is depend on how many percent of the users will want the result to be exported. Otherwise, always keep the result in
Session but most of the time it will never be used isn't a good idea.