473,387 Members | 1,404 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,387 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 3298
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
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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...

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.