472,805 Members | 1,357 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

ViewState

Why does my viewstate not seem to have an effect after the first server
roundtrip?
Nov 21 '05 #1
3 3278
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.com> wrote in message
news:eT**************@TK2MSFTNGP12.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**********@gmail.com> wrote in message
news:%2****************@TK2MSFTNGP14.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.com> wrote in message
news:eT**************@TK2MSFTNGP12.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**********@gmail.com> wrote in message
news:%2****************@TK2MSFTNGP14.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.com> wrote in message
news:eT**************@TK2MSFTNGP12.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
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...
3
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...
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...
1
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...
7
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...
3
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...
9
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...
6
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...
6
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...
12
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
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 2 August 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: erikbower65 | last post by:
Using CodiumAI's pr-agent is simple and powerful. Follow these steps: 1. Install CodiumAI CLI: Ensure Node.js is installed, then run 'npm install -g codiumai' in the terminal. 2. Connect to...
0
by: erikbower65 | last post by:
Here's a concise step-by-step guide for manually installing IntelliJ IDEA: 1. Download: Visit the official JetBrains website and download the IntelliJ IDEA Community or Ultimate edition based on...
0
by: Taofi | last post by:
I try to insert a new record but the error message says the number of query names and destination fields are not the same This are my field names ID, Budgeted, Actual, Status and Differences ...
14
DJRhino1175
by: DJRhino1175 | last post by:
When I run this code I get an error, its Run-time error# 424 Object required...This is my first attempt at doing something like this. I test the entire code and it worked until I added this - If...
5
by: DJRhino | last post by:
Private Sub CboDrawingID_BeforeUpdate(Cancel As Integer) If = 310029923 Or 310030138 Or 310030152 Or 310030346 Or 310030348 Or _ 310030356 Or 310030359 Or 310030362 Or...
0
by: lllomh | last post by:
How does React native implement an English player?
0
by: Mushico | last post by:
How to calculate date of retirement from date of birth
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...

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.