473,326 Members | 2,805 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,326 software developers and data experts.

Viewsatate

I am curious about viewstate. I thought viewstate is pretty much handled by
ASP.NET but I have read a lot about uses of calling/retrieving values from
viewstate or saving a value to viewstate. If viewstate is managed by
ASP.NET in what cases does it need to be managed by the developer?

Does anyone have some good articles on viewstate that could better help me?

Thanks
Nov 18 '05 #1
3 1183
ViewState is pretty much handled by ASP.NET but is exposed so that a
developer can use it to persist data across postbacks. It becomes yet
another option for retaining state. One example of when you would tap into
this is User Controls. Let's say you create an Order User Control that has
an OrderID property. You could persist that property to viewstate and then
the caller could set the property just once not after every postback.

This article tells everything you'd ever want to know about viewstate:
http://msdn.microsoft.com/msdnmag/is...2/CuttingEdge/

--
Hope this helps,
Bryant Hankins
Numinet Systems Inc.
http://www.numinet.com

"Brian Shannon" <bs******@lbrspec.com> wrote in message
news:eh****************@TK2MSFTNGP09.phx.gbl...
I am curious about viewstate. I thought viewstate is pretty much handled by ASP.NET but I have read a lot about uses of calling/retrieving values from
viewstate or saving a value to viewstate. If viewstate is managed by
ASP.NET in what cases does it need to be managed by the developer?

Does anyone have some good articles on viewstate that could better help me?
Thanks

Nov 18 '05 #2
http://msdn.microsoft.com/library/de...sp11222001.asp

http://msdn.microsoft.com/library/de.../viewstate.asp

Hope this helps.

"Brian Shannon" <bs******@lbrspec.com> wrote in message
news:eh**************@TK2MSFTNGP09.phx.gbl...
I am curious about viewstate. I thought viewstate is pretty much handled by
ASP.NET but I have read a lot about uses of calling/retrieving values from
viewstate or saving a value to viewstate. If viewstate is managed by
ASP.NET in what cases does it need to be managed by the developer?

Does anyone have some good articles on viewstate that could better help me?

Thanks

Nov 18 '05 #3
ViewState is similar to many ASP.Net entities in that it has a server-side
component and a client-side component. The client-side component is a hidden
form field containing the compressed values of all ViewState objects in the
Page. On the server-side, ViewState is a serializable Name-Value Collection
that is a property of each Control (each Control has and manages its own
ViewState). Because it is a public Collection, it is accessible on the
server programmatically, and you can read, add, modify, and remove elements
from the Collection.

To say that ViewState is "handled by ASP.Net" is only partially correct.
Every Control that uses ViewState manages its' own ViewState (not ASP.Net er
se). However, there are times when you may want to persist some serialzable
data across PostBacks without using Session or some other server-side
caching mechanism. By adding that data to the Page's ViewState, or any of
its Controls ViewState, you can do this. Also, you may develop your own
Server Controls, in which case you will have to write the code that manages
its ViewState.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

"Brian Shannon" <bs******@lbrspec.com> wrote in message
news:eh**************@TK2MSFTNGP09.phx.gbl...
I am curious about viewstate. I thought viewstate is pretty much handled by ASP.NET but I have read a lot about uses of calling/retrieving values from
viewstate or saving a value to viewstate. If viewstate is managed by
ASP.NET in what cases does it need to be managed by the developer?

Does anyone have some good articles on viewstate that could better help me?
Thanks

Nov 18 '05 #4

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

Similar topics

7
by: Marco | last post by:
Is it possible to access an variables' value, using javascript The variable is created on the code behind What i want to know is if i give a value to an variable created in the code behind, is it...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.