Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

input control values get persisted in postback WITHOUT viewstate ?

Posted on 2009-05-14
8
Medium Priority
?
260 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 2000 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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

New benefit for Premium Members - Upgrade now!

Ready to get started with anonymous questions today? It's easy! Learn more.

Question has a verified solution.

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

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
In this Article, I will provide a few tips in problem and solution manner. Opening an ASPX page in Visual studio 2003 is very slow. To make it fast, please do follow below steps:   Open the Solution/Project. Right click the ASPX file to b…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…

704 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