preserve data after Server.Transfer is used

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • GatorKnight904
    New Member
    • Feb 2008
    • 2

    preserve data after Server.Transfer is used

    Does anyone know how to preserve data after Server.Transfer is used? What is happening is:

    I am using the Server.Transfer method to send a 3 values from page 1 to page 2 on a website. Then a button is clicked which is suppose to load a hyperlink with 2 of the 3 values from page 1 and 2 new values from page 2. These values will be sent to page 3 through a query string after clicking the newly enabled hyperlink.

    The problem I am having is when the button is clicked on page 2 the page posts back to itself and erases the values that were just sent to page 2 from page 1. Those valuse are needed to send to page 3 by query string.

    Does anyone know how to save that data on page 2 once it is sent from page 1 so it will not be erased once the page posts back to itself? THANKS!!!!!
  • DrBunchman
    Recognized Expert Contributor
    • Jan 2008
    • 979

    #2
    Hi,

    Have you tried using hidden variables to store the data? These would be retained if you were re-submitting a form back to the same page. e.g.

    <input type='hidden' name='hiddenvar 1' value='<%=Reque st("varfromPage 1")%>' />

    Does this help at all?

    Dr B

    Comment

    • CroCrew
      Recognized Expert Contributor
      • Jan 2008
      • 564

      #3
      Hello GatorKnight904,

      It looks like your passing all your values within QueryStrings. Can’t you just re-add the value that was passed in from page one?

      I.E.

      PageOne.asp:
      Code:
      <a href="Page2.asp?ValueOne=1">Click Me</a>
      PageTwo.asp:
      Code:
      <a href=’Page2.asp?ValueOne=<%=Request("ValueOne")%>&ValueTwo=2’> Click Me</a>
      Hope that helps~

      Comment

      • nedu
        New Member
        • Nov 2006
        • 65

        #4
        Hi,

        Is this code wrking?????? R u need any othr help???????

        Comment

        • GatorKnight904
          New Member
          • Feb 2008
          • 2

          #5
          Thanks for all your help!

          I actually accomplished what i needed by sending a copy of the values to the ViewState on the 1st page load.

          '* Sending FirstName and LastName values to
          '* the view state for use after the page is posted back
          Me.ViewState("F irstName") = Request.Form.It em(1)
          Me.ViewState("L astName") = Request.Form.It em(2)

          Then when the page posted back i recalled the values out of the ViewState and it worked perfectly.

          '* After page is posted back using the viewstate values the page is
          '* restored with the past values before postback
          Me.lblGreeting. Text = "Hello" & " " & Me.ViewState("F irstName") & " " & Me.
          ViewState("Last Name")


          Thanks for all your responses! It is greatly appreciated!!!

          Comment

          Working...