Understanding View State in ASP.NET
page 1 of 9
Published: 30 Jun 2006
Unedited - Community Contributed
The ASP.NET ViewState is a powerful feature and maintains the state of pages between postbacks. This article provides a bird's eye view of View State with code examples whenever appropriate.
by Joydip Kanjilal
Average Rating: 
Views (Total / Last 10 Days): 78806/ 148

What is ViewState and what it is not?

There are some common misconceptions about ViewState.  Let me discuss these points here for the benefit of the readers.  ViewState does not hold the controls, rather it holds the values of the form controls and their corresponding ID's that would otherwise be lost due to a post back because they do not post with the form.  ViewState is not used to hold session data or to transmit data between pages.  ViewState does not recreate the dynamically created controls of a page.  It does not restore the values to the controls after a post back operation.  Taken aback? Yes, it is true.  Even when the ViewState for a control is disabled, still the value would be retained after a post back of the page occurs, for input controls like TextBox or DropDownList.  So then, what is ViewState?  ViewState represents the state of a page when it was last processed on the web server.  It holds the values of a control that has been dynamically changed.

View Entire Article

User Comments

Title: very good   
Name: hasitha
Date: 2006-12-29 8:08:54 AM
u're explaned well.Thank u very much 4 u'r help
Title: i have one question   
Name: Satheesh
Date: 2006-12-27 2:15:56 AM
I have two webpages in asp.net.... one page contains a textfield and a button.... i am storing the value entered in the texbox to viewstate... and i want that viewstate value to be accessed the next page's textfield control... i am getting null reference exception.... how to solve this
Title: Fine   
Name: senthil
Date: 2006-11-16 3:41:03 AM
its really very good, now only i know how to disable viewstate in application level and machine level.
Title: Good Article   
Name: Sebin
Date: 2006-11-15 1:04:07 AM
This is a good article. Try to post more article from JOY
Title: good explanation by joydip   
Name: chrsankar@yahoo.com
Date: 2006-11-03 4:59:55 AM
I have also read few other articles of Joydip.He is really excellent.Please share your knowledge
Title: View State   
Name: Rakesh
Date: 2006-10-17 11:00:03 AM
Very Useful.
Title: Its Good One   
Name: Prashant Narvekar
Date: 2006-09-23 2:10:45 AM
its good one. i really liked it.
Title: View State   
Name: Waqas
Date: 2006-09-20 2:13:38 AM
Nice Article! Keep it up.
Title: Understanding ViewState ASP.NET   
Name: Satya
Date: 2006-09-12 11:30:29 PM
its really nice, you have explained it very nicely with example. Thanks a lot.
Title: great   
Name: nirwan
Date: 2006-09-08 12:48:29 AM
great article
Title: Thank you   
Name: Keroles
Date: 2006-09-07 5:53:44 PM
Thank you for this article
Title: viewstate   
Name: Manoj kumar singh(infotek software and system (p) ltd)
Date: 2006-09-07 2:51:21 AM
This is an excellent article which would help for all asp.net developer
Title: very nice   
Name: jayasimha
Date: 2006-09-02 2:59:26 AM
this article is very nice to understand the view state concept
Title: Coooooooool   
Name: ARauf
Date: 2006-08-31 1:02:04 PM
I liked the way the author explained using examples. Nice work buddy..
ARauf from Pakistan
Title: Nice Article   
Name: Rakesh Nandrajog
Date: 2006-08-30 5:38:49 PM
Really nice article
Title: View State   
Name: Jason Hunt
Date: 2006-08-30 10:02:59 AM
An excellent article. Viewstate is often bloated on new developer's websites. I, myself, presumed I knew enough about it and you and certainly proved me wrong. I'm going to use your information on new development. Thank you for your article and I hope you continue to "educate" the masses.
Title: Superb   
Name: Sana
Date: 2006-08-30 9:30:07 AM
Good article. Clearly said.
Title: hmm   
Name: Rah
Date: 2006-08-30 7:44:14 AM
Continue with the rest of the articles
Title: More detailed explanation   
Name: rekna
Date: 2006-08-30 6:40:07 AM
You can find a more detailed explanation of the viewstate on http://weblogs.asp.net/infinitiesloop/archive/2006/08/03/Truly-Understanding-Viewstate.aspx. It's a long article, but very important to understand the real workings of viewstate, and to avoid some common mistakes!!!
Title: Understanding View State in ASP.NET   
Name: Jitu
Date: 2006-08-30 5:03:45 AM
Really good explaination of viewstate. Author has cover almost all areas of viewstate. Best for beginer and confused programmers.
Title: viewstate   
Name: yogesh
Date: 2006-08-25 6:31:28 AM
Title: Sanjay's View state   
Name: Sanjay Jaiswal
Date: 2006-08-10 6:59:41 AM
This topic was little bit confuse d forme...but after rading this......give the whole logic behind the View State.

extremely good enough!!!!
Title: view state in asp.net   
Name: srilatha
Date: 2006-08-02 5:43:34 AM
The article is very informative. Thanks a lot.
Title: nice way   
Name: Mahesh Kumar Sharma
Date: 2006-08-01 9:53:36 AM
This topic make little confuse me but joydip u done exelent job No body will explain in such deep..like Joydip has explained.. Thanx...
Title: good one   
Name: saurabh
Date: 2006-08-01 6:04:48 AM
u have explained it in a very nice way. please carry it on. i am expecting some more topics to be covered from tou.
Title: great n excellent   
Name: Anonymous
Date: 2006-08-01 5:24:37 AM
No body will explain in such deep..like Joydip has explained.. Thanx...
Title: asp.net examples   
Name: Farooq Ahmad Salmani
Date: 2006-07-14 8:24:54 AM
I want more Examples of asp.net
Title: View State   
Name: Françoise
Date: 2006-07-11 11:55:28 AM
This is a very good explanation the the View State concept.

Thank you very much. 07/11/2006
Title: Very Nice   
Name: Koteswara Rao
Date: 2006-07-10 10:28:56 AM
You have Explained very well about View state in Asp.net. It is most useful for whome Newly started programing in Asp.Net
Title: nice   
Name: venu
Date: 2006-07-08 2:52:59 PM
hi, U explained very well.

some more topics we are expecting from U.
Title: view state   
Name: G.srinivas
Date: 2006-07-06 1:55:21 AM
this site is very useful for the individuals who want to improove their subject.i am thankful to them who had prepared it.this site is helped me to know everything about viewstate in asp.net.oncegain thanking u
Title: View State   
Name: Hadi Alhendi
Date: 2006-07-04 3:10:54 AM
I found this article very useful i want to thanks Joydip for this great article
Title: Very Good   
Name: Rajesh Medackel
Date: 2006-07-04 1:07:19 AM
That was a very good one......:-)

Rajesh Medackel,India
Title: Do The Best   
Name: Viamlram
Date: 2006-07-04 12:53:58 AM
You are explained well.It is derived easy to understand by the beginer.

Product Spotlight
Product Spotlight 

Community Advice: ASP | SQL | XML | Regular Expressions | Windows

©Copyright 1998-2021 ASPAlliance.com  |  Page Processed at 2021-10-22 3:39:34 PM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search