473,668 Members | 2,799 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

ViewState

Why does my viewstate not seem to have an effect after the first server
roundtrip?
Nov 21 '05 #1
3 3301
because you are not rebuilding it probably.

Viewstate is not automatically persistent across server round trips - it
needs to be generated on each trip to the server.
--
Pete Wright
Author of ADO.NET Novice to Pro for Apress
www.petewright.org

"WhoopDing" <vb@whoopding.c om> wrote in message
news:eT******** ******@TK2MSFTN GP12.phx.gbl...
Why does my viewstate not seem to have an effect after the first server
roundtrip?

Nov 21 '05 #2
This is what happens when I post newsgroup messages first thing in the
morning, but do I ever learn my lesson?? ;)

I was confused.

An aspx is called, viewstate is populated and the page is rendered.
When a postback occurs viewstate is there to be used, and will remain
there until you redirect off the page to a different URL. However, the
confusion on my part is that viewstate will get "lost" or corrupted if
during the postback an object is hyrdated from the viewstate and
changed. That object needs to be put back into viewstate since
viewstate is not a reference to a live object.

My apologies for that

"Pete Wright" <pe**********@g mail.com> wrote in message
news:%2******** ********@TK2MSF TNGP14.phx.gbl. ..
because you are not rebuilding it probably.

Viewstate is not automatically persistent across server round trips - it
needs to be generated on each trip to the server.
--
Pete Wright
Author of ADO.NET Novice to Pro for Apress
www.petewright.org

"WhoopDing" <vb@whoopding.c om> wrote in message
news:eT******** ******@TK2MSFTN GP12.phx.gbl...
Why does my viewstate not seem to have an effect after the first server
roundtrip?


Nov 21 '05 #3
This is what happens when I post newsgroup messages first thing in the
morning, but do I ever learn my lesson?? ;)

I was confused.

An aspx is called, viewstate is populated and the page is rendered. When a
postback occurs viewstate is there to be used, and will remain there until
you redirect off the page to a different URL. However, the confusion on my
part is that viewstate will get "lost" or corrupted if during the postback
an object is hyrdated from the viewstate and changed. That object needs to
be put back into viewstate since viewstate is not a reference to a live
object.

My apologies for that
"Pete Wright" <pe**********@g mail.com> wrote in message
news:%2******** ********@TK2MSF TNGP14.phx.gbl. ..
because you are not rebuilding it probably.

Viewstate is not automatically persistent across server round trips - it
needs to be generated on each trip to the server.
--
Pete Wright
Author of ADO.NET Novice to Pro for Apress
www.petewright.org

"WhoopDing" <vb@whoopding.c om> wrote in message
news:eT******** ******@TK2MSFTN GP12.phx.gbl...
Why does my viewstate not seem to have an effect after the first server
roundtrip?


Nov 21 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
21639
by: John Kirksey | last post by:
I have a page that uses an in-place editable DataGrid that supports sorting and paging. EnableViewState is turned ON. At the top of the page are several search fields that allow the user to filter the results in the grid. Say you filter the grid for records that have a certain condition set to "NO" (in this case a checkbox). In this scenario the search returns one result. If I then check the checkbox ("YES") and save it, I now get my message...
3
2639
by: Steve Drake | last post by:
All, I have a CONTROL that contains 1 control (Control ONE), the 1 control that it can contain 1 or 2 control (Control A and B). Control A, raises and event and Control ONE receives this event and this causes control B to be created, when this is done the VIEWSTATE is lost for CONTROL B. In the EVENT that causes CONTROL B to be created I have to set
10
2260
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 disable the session state in Web.Config the VIEWSTATE variable is still maintained and stores some values. Can anyone tell what those values are for, i.e what other info is stored in VIEWSTATE other than the session ID and the control values ?
1
1766
by: Simon | last post by:
Hi everyone, I have a quick question that I hope someone can help me with: I've made a user control that contains a text box and some validation functionality. This control has a few extra properties declared on it over and above that provided by the textbox. As I understand it, part of the process to make this work is, in the property accessor's for the properties that you wish to persist you add
7
2039
by: et | last post by:
I'm not sure I understand the use of the ViewState. Do I understand correctly that values of controls are automatically held in a hidden control called ViewState? If so, then why can't we get them, or how do we get that value? I always have to set the ViewState("FirstName") = txtBox.text myself before a postback is done, otherwise, the value of ViewState("FirstName") is always empty; there doesn't seem to be a way to retrieve that...
3
4561
by: RCS | last post by:
I have an app that I have different "sections" that I want to switch back and forth from, all while having the server maintain viewstate for each page. In other words, when I am on Page1.aspx and set textboxes, radio buttons, etc - that viewstate is fine. Then I have a linkbutton that does a Server.Transfer over to Page2.aspx. When I Server.Transfer back to Page1.aspx, the viewstate info is lost. I ran across another example of this last...
9
1863
by: Mark Broadbent | last post by:
Been a while since I've touched asp.net but one thing that always seems to fustrate me is the loss of state on variable declarations. Is there anyway (i.e. assigning an attribute etc) to instruct the server to remember a variables state *without* having to go through the rigmarole of saving and loading to and from the Session state manually or similar workaround for any Types (including custom types) in exactly the same way web controls...
6
2058
by: hitendra15 | last post by:
Hi I have created web user control which has Repeater control and Linkbutton in ItemTemplate of repeater control, following is the code for this control On first load it runs fine but when page gets post back it gives following error Failed to load viewstate. The control tree into which viewstate is
6
4448
by: paul.hester | last post by:
Hi all, Does anyone know why the ViewState would be empty? When I'm receiving a postback, I can access a posted value using controlName.Value but not ViewState. I have EnableViewState set to true in my master page and content page. Thanks,
12
1915
by: Nick C | last post by:
Hi How can i reduce the viewstate for my asp.net application. It is getting very large now. What is a good solution? thanks N
0
8462
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8797
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8583
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7401
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5681
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4205
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4380
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2791
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2023
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.