Can I cache a DataTable (or alternative GridView Datasource) in a
... and does the following scenario present itself as an occaison when
I could get away with doing so?
In an Asp.Net 2.0 app. I have a search results page. The results are
diplayed in a GridView with paging and sorting. In would prefer to get
all the data and do the paging/sorting in memory rather than adding to
the complexity of the T-SQL. It's not so much the paging that bothers
me as the sorting (that would be awful - I'd have to put the raw
results in a table variable first, then query the table variable to
get the paged/sorted results).
On any one day there are only about 100 clients who would use this web-
site (not concurrently). The site shares a server with an even less
Q1: Am I right in thinking that this data should not be cached in the
Data Cache because each client will have entirely different search
results. (For instance, if two clients use the search page at the same
time that will lead to inconsistenty. - as the second client's data is
cached in the same Cache object as the first.)
Q2: Will it be possible to cache the DataSource for the GridView as
Session object instead? (assuming the above problems with the Data
Q3: If I cache in the Session, apart from destroying the session
object (i.e the cached data) on leaving the page - are there any other
Q4: Would the DataSource need to be serializable for it to be storeded
as a session object?.