General ASP question

T

Tom Edelbrok

I'm reading the section "Postbacks and Round Trips" in the Visual Studio
2005 Help (I use VB.NET). Amongst other things, it says that as a result of
a postback "On the Web server, the page runs again. The information that the
user typed or selected is available to the page."

I can set this up in a test project and see that it occurs ... ie: my text
boxes retain their data (ie: "Hello world") even when a postback occurs on
the same or another server control.

If as a result of a postback the web page gets re-rendered at the server,
then how does the text in my textbox (or data in any other sort of server
control) get maintained? I would have thought that if the web-page gets
rebuilt from scratch, any data in controls would be lost.

Can someone explain how this works?

Thanks,

Tom Edelbrok
 
B

Bob Barrows [MVP]

Tom said:
I'm reading the section "Postbacks and Round Trips" in the Visual
Studio 2005 Help (I use VB.NET).

There was no way for you to know it (except maybe by browsing through some
of the previous questions before posting yours - always a recommended
practice), but this is a classic asp newsgroup.
While you may be lucky enough to find a dotnet-knowledgeable person here who
can answer your question, you can eliminate the luck factor by posting your
question to a group where those dotnet-knowledgeable people hang out. I
suggest microsoft.public.dotnet.framework.aspnet.
Amongst other things, it says that
as a result of a postback "On the Web server, the page runs again.
The information that the user typed or selected is available to the
page."
I can set this up in a test project and see that it occurs ... ie: my
text boxes retain their data (ie: "Hello world") even when a postback
occurs on the same or another server control.

If as a result of a postback the web page gets re-rendered at the
server, then how does the text in my textbox (or data in any other
sort of server control) get maintained? I would have thought that if
the web-page gets rebuilt from scratch, any data in controls would be
lost.
Look up ViewState in the online help.
 
G

Guffa

If as a result of a postback the web page gets re-rendered at the server,
then how does the text in my textbox (or data in any other sort of server
control) get maintained?

When the control is recreated it gets the value from the data sent from the
form.

Controls also store some stuff in ViewState to maintain it across postbacks.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top