473,385 Members | 1,817 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Form postbacks not in viewstate?

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
3 1159
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
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
"> 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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Warren J. Hairston | last post by:
Can anyone point me toward a solution for persisting non-controls (i.e.: a stack) across PostBacks? TIA! - Warren
3
by: Hadar | last post by:
Hi, I'm still a little bit confused with how managing a webcontrol state over postbacks... Should I use the form's post values to populate the control on the server side when possible, or...
4
by: Davids | last post by:
in my small hangman web project I have a Hangman class which has some methods and properties (int GuessAttempts, string GuessedLetters etc..) which change as the game goes on... Best of all would...
2
by: Jim | last post by:
I have a C# Web application that has 1 Web form that has 2 command buttons on it with a label for output. I have a form level variable declared String strName = "Jim"; right below where the...
12
by: Alan Silver | last post by:
Hello, I have a page that gets passed an ID in the query string. It then uses this ID to pull info out of a database and populate controls on the page. When the page is posted back, the query...
9
by: Jamie | last post by:
I am receiving an Invalid ViewState error after posting back to the same page twice. Consistently the error occurs after the second postback and not after the first. I have looked into creating...
1
by: Joe Abou Jaoude | last post by:
hi, I just want simply to preserve some data in my usercontrol on postbacks. so I added this property in my UserControl Protected Property MyProperty() As String Get If Not...
4
by: Nathan Sokalski | last post by:
I have 2 private variables in my class that I need to remember the values of between postbacks (or actually callbacks, since I am using AJAX). I want to avoid using session variables, if possible....
4
by: Usenet User | last post by:
Platform: IIS 5 or 6, ASP .NET 1.1 I can configure default page for my virtual directory and "hide" that page from users. For example, if I have an ASPX from called MyPage.aspx, I can make it...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.