473,404 Members | 2,114 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,404 software developers and data experts.

How do I save viewstate programmatically?

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
1 1971
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Hardy Wang | last post by:
Hi all: I developed a web site, it passed various testing internally. When I put this site in production, I receive some error reports from this site saying "the viewstate is invalid for this page...
1
by: Adrijan Josic | last post by:
I have a bunch of user controls that contain TextBoxes, Repeaters and so on. Some of the user controls even contain other user controls. The user controls also usually have some of their...
10
by: neo | last post by:
hi, I am studying ASP.NET and have few questions - 1) The session ID and values of controls is stored in VIEWSTATE variable. So now when we put EnableViewState="false" in Page directive and...
8
by: Invalidlastname | last post by:
Hi, We are developing an asp.net application, and we dynamically created certain literal controls to represent some read-only text for certain editable controls. However, recently we found an issue...
2
by: NewsAccount | last post by:
Hi I'm trying to find a way to programmatically measure the size of the page sent down to the browser, can't seem to measure the length of what gets written to the HTML TextWriter in protected...
2
by: Leo Muller | last post by:
I tried to simplify my problem. What I want to do is to save a string in a variables, and everytime I click a button, the variable string gets a bit longer by adding the time to it: on the form...
2
by: John Dalberg | last post by:
I have a page with a few textboxes. When the page is posted, the textfields retain their values even though I have viewstate turned off. It's turned off in 2 different places. - The control...
1
by: Irene | last post by:
Hello all! I'm creating a web site in ASP.NET (VB.NET). One of the requirements was to allow users to create orders going through several steps. A must have is to have an option to save the work...
6
by: AAOMTim | last post by:
I have a large ViewState and I've heard I can save the ViewState in a sesison object. What are the advantages of doing so and how do I do it? I've been told that I am gettign DNS timeouts because...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.