General ASP question

Discussion in 'ASP General' started by Tom Edelbrok, Apr 19, 2006.

  1. Tom Edelbrok

    Tom Edelbrok Guest

    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
    Tom Edelbrok, Apr 19, 2006
    #1
    1. Advertising

  2. Tom Edelbrok wrote:
    > 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.

    --
    Microsoft MVP - ASP/ASP.NET
    Please reply to the newsgroup. This email account is my spam trap so I
    don't check it very often. If you must reply off-line, then remove the
    "NO SPAM"
    Bob Barrows [MVP], Apr 19, 2006
    #2
    1. Advertising

  3. Tom Edelbrok

    Guffa Guest

    > 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.
    Guffa, Apr 20, 2006
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. David
    Replies:
    6
    Views:
    447
    David
    Feb 13, 2004
  2. Baldy
    Replies:
    1
    Views:
    359
    Lucas Tam
    Oct 17, 2004
  3. Replies:
    3
    Views:
    431
    Clint Hill
    Jul 25, 2005
  4. Replies:
    2
    Views:
    530
    Ranginald
    Apr 13, 2006
  5. Robin
    Replies:
    2
    Views:
    103
    richard
    Feb 23, 2011
Loading...

Share This Page