How do I save viewstate programmatically?

  • Thread starter Thread starter RHIZOME
  • Start date Start date
R

RHIZOME

I am reparameterizing a SqlDataSource programmatically, using runtime
events. This works nicely for on-the-fly search, but sorting and
paging are using the original (declared) version of my SqlDataSource.
The net effect is that I lose all of my runtime parameters, when I sort
or page in a GridView thats bound to my SqlDataSource. The
SqlDataSource reverts to its original viewstate from when the page
first loaded, when a user clicks a sort or paging link. I've tried to
invoke SavePageStateToPersistenceMedium, but since its protected, this
doesn't work from my page's codebehind scope. I've seen recipes for
overriding it and implementing your own persistence strategy. This
seems beyond my present need, which is just to ensure that my
SqlDataSource is current within viewstate, so that its sorted and paged
data reflects the most current state. Any easy way to do this?
 
How about then overriding just LoadViewState and SaveViewState methods as
they concenrn only saving and loading the state, not the persistence medium?
 
Back
Top