Simple Beginner Question (I believe)

Discussion in 'ASP .Net' started by pvdg42, Apr 22, 2006.

  1. pvdg42

    pvdg42 Guest

    VS 2003, C# if the language matters.
    Scenario:
    Two page project, text box content on the start page is loaded into session
    variables to be displayed in a greeting on the second page. Works fine the
    first trip.
    If upon return from the second page to the start page, the user enters new
    data into the text boxes and then navigates (code in the navButton_Click
    event procedure loads the session variables) to the second page, the old
    data is still displayed.
    Stepping through in the debugger seems to indicate that new data entry into
    the text boxes does not cause the start page to be redrawn, thus the new
    data shown in the interface is never transferred to the text property of the
    text boxes?

    Any thoughts appreciated!
     
    pvdg42, Apr 22, 2006
    #1
    1. Advertising

  2. The start page is not "redrawn," it is created when a PostBack occurs. Are
    you re-setting the Session variables prior to doing your redirect?

    --
    HTH,

    Kevin Spencer
    Microsoft MVP
    Professional Numbskull

    Hard work is a medication for which
    there is no placebo.

    "pvdg42" <> wrote in message
    news:ugl%...
    > VS 2003, C# if the language matters.
    > Scenario:
    > Two page project, text box content on the start page is loaded into
    > session variables to be displayed in a greeting on the second page. Works
    > fine the first trip.
    > If upon return from the second page to the start page, the user enters new
    > data into the text boxes and then navigates (code in the navButton_Click
    > event procedure loads the session variables) to the second page, the old
    > data is still displayed.
    > Stepping through in the debugger seems to indicate that new data entry
    > into the text boxes does not cause the start page to be redrawn, thus the
    > new data shown in the interface is never transferred to the text property
    > of the text boxes?
    >
    > Any thoughts appreciated!
    >
     
    Kevin Spencer, Apr 22, 2006
    #2
    1. Advertising

  3. pvdg42

    pvdg42 Guest

    "Kevin Spencer" <> wrote in message
    news:OWeI2$...
    > The start page is not "redrawn," it is created when a PostBack occurs. Are
    > you re-setting the Session variables prior to doing your redirect?
    >
    > --
    > HTH,
    >
    > Kevin Spencer
    > Microsoft MVP
    > Professional Numbskull
    >
    > Hard work is a medication for which
    > there is no placebo.
    >

    Yes, I believe so. The code in the click event procedure for the navigate
    button is:

    Session[ "name" ] = txtName.Text;

    Session[ "phonenumber" ] = txtPhoneNumber.Text;

    // redirect to RoadTestRegistered.aspx page

    Response.Redirect( "RoadTestRegistered.aspx" );

    This works fine the first time the user fills in the text boxes and
    navigates to the second page. If the user then returns to the first page and
    enters new information in the text boxes, the app acts as it the new entries
    have been ignored when the navigate button is clicked the second time. The
    old (first entries) information reappears on the second page.
     
    pvdg42, Apr 23, 2006
    #3
  4. How is the user returning to the first page?

    --
    HTH,

    Kevin Spencer
    Microsoft MVP
    Professional Numbskull

    Hard work is a medication for which
    there is no placebo.

    "pvdg42" <> wrote in message
    news:%...
    >
    > "Kevin Spencer" <> wrote in message
    > news:OWeI2$...
    >> The start page is not "redrawn," it is created when a PostBack occurs.
    >> Are you re-setting the Session variables prior to doing your redirect?
    >>
    >> --
    >> HTH,
    >>
    >> Kevin Spencer
    >> Microsoft MVP
    >> Professional Numbskull
    >>
    >> Hard work is a medication for which
    >> there is no placebo.
    >>

    > Yes, I believe so. The code in the click event procedure for the navigate
    > button is:
    >
    > Session[ "name" ] = txtName.Text;
    >
    > Session[ "phonenumber" ] = txtPhoneNumber.Text;
    >
    > // redirect to RoadTestRegistered.aspx page
    >
    > Response.Redirect( "RoadTestRegistered.aspx" );
    >
    > This works fine the first time the user fills in the text boxes and
    > navigates to the second page. If the user then returns to the first page
    > and enters new information in the text boxes, the app acts as it the new
    > entries have been ignored when the navigate button is clicked the second
    > time. The old (first entries) information reappears on the second page.
    >
    >
     
    Kevin Spencer, Apr 23, 2006
    #4
  5. pvdg42

    pvdg42 Guest

    "Kevin Spencer" <> wrote in message
    news:...
    > How is the user returning to the first page?
    >
    > --
    > HTH,
    >
    > Kevin Spencer
    > Microsoft MVP
    > Professional Numbskull
    >

    1. I appreciate you bearing with me :)

    2. Via Response.Redirect()
    And, I now see that if the browser back button is used instead, the new
    values *do* get recognized. Looks like I need a hammer and am trying to use
    a screwdriver.
    Thanks very much.
     
    pvdg42, Apr 23, 2006
    #5
  6. Hi Pvdg42,

    I agree that the client-side browser's back/forward button is the cause.
    When we use back/forward button on client-side browser to navigate page, it
    will used the cached item and data in client-side's browser cache, so this
    may not works as expected, we can output some http header to prevent
    client-side caching, e.g:

    #How to prevent caching in Internet Explorer
    http://support.microsoft.com/kb/234067/en-us

    it provide the example on ASP pages, and ASP.NET also support this (and
    provide the Response.Cache property which provide more features on cache
    control).

    Hope this also helps.

    Regards,

    Steven Cheng
    Microsoft Online Community Support


    ==================================================

    When responding to posts, please "Reply to Group" via your newsreader so
    that others may learn and benefit from your issue.

    ==================================================


    This posting is provided "AS IS" with no warranties, and confers no rights.



    Get Secure! www.microsoft.com/security
    (This posting is provided "AS IS", with no warranties, and confers no
    rights.)
     
    Steven Cheng[MSFT], Apr 24, 2006
    #6
    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. malik

    Believe iT or NOT!!!

    malik, Feb 19, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    369
    malik
    Feb 19, 2004
  2. chas
    Replies:
    3
    Views:
    369
    Roedy Green
    Nov 18, 2003
  3. Giorgio Franceschetti

    Cannot believe this. Problems with double and float

    Giorgio Franceschetti, Jan 16, 2004, in forum: Java
    Replies:
    3
    Views:
    440
    Giorgio Franceschetti
    Jan 19, 2004
  4. El Good

    TRY IT TO BELIEVE IT...

    El Good, Jan 9, 2006, in forum: Java
    Replies:
    0
    Views:
    427
    El Good
    Jan 9, 2006
  5. Aaron
    Replies:
    6
    Views:
    303
    terminator
    Jun 9, 2007
Loading...

Share This Page