As by the Question .Is this a Good Practice to store a datable in view state If not then what i need to do for Performance and security measures.
What i lacks when i go with security and to performance and viceversa.
What i trying to do. is showing data in Gridview by DataTable(Source ) .In the postBacks. i want to save my Query Cost.Load data from view state or Cache object but not by Database.
A
DataTableis quite a large object – storing it inViewStatewill bloat it and add to the download times of each request it is present on. In this respect not good for performance.In terms of security –
ViewStatecan be deciphered on the client side, so theDataTableis not secure.What you need to do depends on what you are trying to achieve (which you have not indicated at all in your question).
You may want to store it server side in the
CacheorSessionobjects, re-fetch it from the data store. It depends on the requirements.