Viewstate will only hold the contents of the grid. By contents I mean the
HTML generated to display the contents of the data source.
The datatable itself will not be there. So you have to recreate it, sort,
and rebind.
"pmanno" <> wrote in message
news: oups.com...
> If I have a page with a DataGrid that is bound to a DataTable that is
> populated by a query to a database and I want to enable sorting and
> paging, do I have to add the DataTable to the cache or will the
> viewstate hold the contents of the DataTable?
>
> Basically, I want to avoid hitting the database wherever I can. It
> seems that the DataTable has to be cached and the DataGrid re-bound, or
> the DataTable has to be re-populated from the database and the DataGrid
> re-bound whenever a postback occurs since the DataTable and therefore
> the data which is bound to the grid is discarded once the page renders.
>
> Thanks.
>
|