Solved

input control values get persisted in postback WITHOUT viewstate ?

Posted on 2009-05-14
8
254 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
 
LVL 19

Expert Comment

by:daveamour
ID: 24393465
I've been doing asp.net for 7 years and still feel like a beginner!
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

In an ASP.NET application, I faced some technical problems. In this article, I list them out and show the solutions that I found.  I hope it will be useful. Problem: After closing a pop-up window, the parent page should be refreshed automaticall…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…
Both in life and business – not all partnerships are created equal. As the demand for cloud services increases, so do the number of self-proclaimed cloud partners. Asking the right questions up front in the partnership, will enable both parties …

896 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