Solved

input control values get persisted in postback WITHOUT viewstate ?

Posted on 2009-05-14
8
257 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 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
Technology Partners: 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

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!

Question has a verified solution.

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

I have developed many web applications with asp & asp.net and to add and use a dropdownlist was always a very simple task, but with the new asp.net, setting the value is a bit tricky and its not similar to the old traditional method. So in this a…
Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

733 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