By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,992 Members | 967 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,992 IT Pros & Developers. It's quick & easy.

How do I save viewstate programmatically?

P: n/a
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?

Sep 4 '06 #1
Share this Question
Share on Google+
1 Reply


P: n/a
How about then overriding just LoadViewState and SaveViewState methods as
they concenrn only saving and loading the state, not the persistence medium?

--
Teemu Keiski
ASP.NET MVP, AspInsider
Finland, EU
http://blogs.aspadvice.com/joteke
"RHIZOME" <jh*****@networklogistic.comwrote in message
news:11**********************@e3g2000cwe.googlegro ups.com...
>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?

Sep 4 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.