Solved

input control values get persisted in postback WITHOUT viewstate ?

Posted on 2009-05-14
8
256 Views
Last Modified: 2012-05-07
A few weeks into ASP.net and a newbie question...

Have I got this right ?

In an *.aspx page, as long as the <form> is set to runat="server", then ANY (i.e. HTML, web-) controls with runat="server" will have their last/current values reset after a postback occurs
..(and here's the key..).. WITHOUT needing viewstate enabled

IE when the page gets submitted to itself ASP.NET uses the form data to see what the current values of the controls are, and if they are runat=server, sets them to the same value in the new page ?

THEREFORE: viewstate is only needed for control info that is NOT sent in form data, e.g. color, font etc. (or for controls not marked as runat=server, but why you'd want to do this.... etc. etc.), or for custom info the programmer adds to viewstate "manually"...

Empirically, by running tests, this seems to happen
However TWO books by Apress fail to mention this KEY FACT !!, apart from a few asides in UNRELATED chapters....

ALSO, can anyone point me to an official documentation (or failing that unofficial) that verifies this and explains/confirms it

many thanks!!
0
Comment
Question by:zorba111
  • 4
  • 4
8 Comments
 

Author Comment

by:zorba111
ID: 24383614
this looks like a good UNOFFICIAL explanation

http://www.codeproject.com/KB/viewstate/ViewState.aspx

still holding out for Official docs, or more succinct unofficial explains
0
 
LVL 19

Accepted Solution

by:
daveamour earned 500 total points
ID: 24392786
Viewstate has nothing to do with input controls maintaining inputted data.
This article is brilliant, a little long but well worth the read if you have time.
http://weblogs.asp.net/infinitiesloop/archive/2006/08/03/Truly-Understanding-Viewstate.aspx 
0
 

Author Comment

by:zorba111
ID: 24393456
thanks Dave, that is a great article !!

I got 80% of it on first read, which movre than covered my questions. Now I feel like an ASP.net cognoscenti and which is not bad for 3 weeks in. oh my swelling head! :-)
0
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

 
LVL 19

Expert Comment

by:daveamour
ID: 24393465
I've been doing asp.net for 7 years and still feel like a beginner!
0
 

Author Comment

by:zorba111
ID: 24393492
I know my feelings of imperiousness will not last long as no doubt I will hit another humbling problem quite soon - such is the way of tech

but for the moment I'm enjoying the conceit....
 :-)

thanks again for the pointer
0
 
LVL 19

Expert Comment

by:daveamour
ID: 24393503
Your welcome and yes once youve learned everything it will all be obsolete!
0
 

Author Comment

by:zorba111
ID: 24393768
you're right, how often these days have I had to create a COM object, implement an interface, or use an ATL ?

or for that matter hook into a windows message pump ?
or do memory management in Win32

many a weighty tome gathering dust on my shelf

LOL
0
 
LVL 19

Expert Comment

by:daveamour
ID: 24393778
Yep they make great door stoppers or firewood!
0

Featured Post

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

I recently went through the process of creating a Calendar Control of events with the basis of using a database to keep track of the dates that are selectable, one requirement was to have the selected date pop-up in a simple lightbox.  At first this…
User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…

816 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now