By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,393 Members | 1,405 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,393 IT Pros & Developers. It's quick & easy.

Form postbacks not in viewstate?

P: n/a
Hi
I have only just become aware that form values posted to the server don't
need to be preserved in viewstate because asp.net preserves them anyway
separately from this.
2 questions
(1) What is the mechanism that preserves them? (Purely for academic interest)
(2) I have a property on a control that is added to the viewstate. With
trace on and some code that shows the contents of the viewstate I see
that information both in the viewstate and in the "Form Collection" section
of the page trace. Is it in both or am I being mislead?
NB My understanding of the "Form Collection" section is that it shows all
the values posted back to the server and viewstate is just one of those values.

Ta
F
Nov 18 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
1) This is not an ASP.NET feature. When you press a submit button, the
browser sends a HTTP request to the server. This request contains the value
of all non disabled, named fields that are in your form.
2) The viewstate is an hidden field (as such it is posted by the browser
when the submit button is hit allowing the server to read the viewstate).

ASP.NET is a clever hack but just uses client side what was available
previously (HTML, HTTP).

Patrice
<fo******@yahoo.co.uk> a écrit dans le message de
news:ac**************************@posting.google.c om...
Hi
I have only just become aware that form values posted to the server don't need to be preserved in viewstate because asp.net preserves them anyway
separately from this.
2 questions
(1) What is the mechanism that preserves them? (Purely for academic interest) (2) I have a property on a control that is added to the viewstate. With
trace on and some code that shows the contents of the viewstate I see
that information both in the viewstate and in the "Form Collection" section of the page trace. Is it in both or am I being mislead?
NB My understanding of the "Form Collection" section is that it shows all the values posted back to the server and viewstate is just one of those values.
Ta
F

Nov 18 '05 #2

P: n/a
Hi,

I have discussed some of this from TextBox control's standpoint. Maybe it
helps you.

http://blogs.aspadvice.com/joteke/ar...03/15/767.aspx

--
Teemu Keiski
MCP, Microsoft MVP (ASP.NET), AspInsiders member
ASP.NET Forum Moderator, AspAlliance Columnist
http://blogs.aspadvice.com/joteke
<fo******@yahoo.co.uk> wrote in message
news:ac**************************@posting.google.c om...
Hi
I have only just become aware that form values posted to the server don't need to be preserved in viewstate because asp.net preserves them anyway
separately from this.
2 questions
(1) What is the mechanism that preserves them? (Purely for academic interest) (2) I have a property on a control that is added to the viewstate. With
trace on and some code that shows the contents of the viewstate I see
that information both in the viewstate and in the "Form Collection" section of the page trace. Is it in both or am I being mislead?
NB My understanding of the "Form Collection" section is that it shows all the values posted back to the server and viewstate is just one of those values.
Ta
F

Nov 18 '05 #3

P: n/a
"> I have discussed some of this from TextBox control's standpoint. Maybe it
helps you.

http://blogs.aspadvice.com/joteke/ar...03/15/767.aspx


yep, thats what I wanted, thanks. I knew normal html posted back info
but the mechanism for placing the posted back info back into the control
is within the control itself, not within some obscure bit of the .Net
architecture.
My confusion was because theres the .Net case, the normal html case, and
the case where you don't have a <form> tag around html, i.e. noddy test
cases and trying to work out what happens in each case and why.
Nov 18 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.