Server.Transfer Second Parameter Set To True?

Discussion in 'ASP .Net Web Controls' started by mathieu cupryk, Aug 21, 2003.

  1. I have a form on step1.aspx and step2.aspx

    When I click the button I do a server.transfer (step2.aspx, true). If I
    use click the previous button I have in step2.aspx it calls a
    server.transfer (step1.aspx, true).

    I would like to see the form step1.aspx with all the values displays
    instead of the textboxes empty.

    more example of what I need to do?

    I am passing variables from one form page to another form page in aspx.

    Now if I do a click on the second page to go back to the first page all

    The text fields are empty. How do I keep them?

    void Button2_Previous (object sender, ImageClickEventArgs e)

    {



    Server.Transfer("step1.aspx",true);

    }

    <TITLE>ASPNETPage1.aspx</TITLE>
    <%@ Page language="c#" %>
    <script runat=server>
    // We iterate through the Form collection and assign the names and
    values
    // to ASP.NET session variables! We have another Session Variable,
    "DestPage"
    // that tells us where to go after taking care of our business...
    private void Page_Load(object sender, System.EventArgs e)
    {
    for(int i=0;i<Request.Form.Count;i++)
    {
    Session[Request.Form.GetKey(i)]=Request.Form.ToString();
    }
    Server.Transfer(Session["DestPage"].ToString(),true);
    }
    </script>
    ========================================================================
    ======

    <TITLE>FinalPage.aspx</TITLE>
    <%@ Page language="c#" %>
    <script runat=server>
    // This page is just a "proof of concept page"...

    private void Page_Load(object sender, System.EventArgs e)
    {
    Response.Write("Shared Session Variable Names/Values between Classic ASP
    and ASP.NET:<BR>");
    for (int i = 0; i < Session.Contents.Count; i++)
    {
    Response.Write("Assigned to \"" +Session.Keys.ToString()+"\"");
    Response.Write(" Value: "+ Session.ToString() +"<BR>");
    }
    }
    </script>





    *** Sent via Developersdex http://www.developersdex.com ***
    Don't just participate in USENET...get rewarded for it!
    mathieu cupryk, Aug 21, 2003
    #1
    1. Advertising

  2. mathieu cupryk

    Alvin Bruney Guest

    the true variable preserves session variables it doesn't load them into the
    form. your code needs to take care of that. you will need to store the
    variables and then retrieve then and load them into the new page
    "mathieu cupryk" <> wrote in message
    news:#YAZBN#...
    >
    > I have a form on step1.aspx and step2.aspx
    >
    > When I click the button I do a server.transfer (step2.aspx, true). If I
    > use click the previous button I have in step2.aspx it calls a
    > server.transfer (step1.aspx, true).
    >
    > I would like to see the form step1.aspx with all the values displays
    > instead of the textboxes empty.
    >
    > more example of what I need to do?
    >
    > I am passing variables from one form page to another form page in aspx.
    >
    > Now if I do a click on the second page to go back to the first page all
    >
    > The text fields are empty. How do I keep them?
    >
    > void Button2_Previous (object sender, ImageClickEventArgs e)
    >
    > {
    >
    >
    >
    > Server.Transfer("step1.aspx",true);
    >
    > }
    >
    > <TITLE>ASPNETPage1.aspx</TITLE>
    > <%@ Page language="c#" %>
    > <script runat=server>
    > // We iterate through the Form collection and assign the names and
    > values
    > // to ASP.NET session variables! We have another Session Variable,
    > "DestPage"
    > // that tells us where to go after taking care of our business...
    > private void Page_Load(object sender, System.EventArgs e)
    > {
    > for(int i=0;i<Request.Form.Count;i++)
    > {
    > Session[Request.Form.GetKey(i)]=Request.Form.ToString();
    > }
    > Server.Transfer(Session["DestPage"].ToString(),true);
    > }
    > </script>
    > ========================================================================
    > ======
    >
    > <TITLE>FinalPage.aspx</TITLE>
    > <%@ Page language="c#" %>
    > <script runat=server>
    > // This page is just a "proof of concept page"...
    >
    > private void Page_Load(object sender, System.EventArgs e)
    > {
    > Response.Write("Shared Session Variable Names/Values between Classic ASP
    > and ASP.NET:<BR>");
    > for (int i = 0; i < Session.Contents.Count; i++)
    > {
    > Response.Write("Assigned to \"" +Session.Keys.ToString()+"\"");
    > Response.Write(" Value: "+ Session.ToString() +"<BR>");
    > }
    > }
    > </script>
    >
    >
    >
    >
    >
    > *** Sent via Developersdex http://www.developersdex.com ***
    > Don't just participate in USENET...get rewarded for it!
    Alvin Bruney, Aug 22, 2003
    #2
    1. Advertising

  3. Can u demonstrate an example with say an textbox
    txtEmail?

    *** Sent via Developersdex http://www.developersdex.com ***
    Don't just participate in USENET...get rewarded for it!
    mathieu cupryk, Aug 22, 2003
    #3
  4. mathieu cupryk

    Alvin Bruney Guest

    on one page
    Session["Val"] = TextBox1.Text;
    Server.Transfer("page2.aspx",true);

    on page2.aspx in page_load
    if(Session["Val"]!= null)
    TextBox2.Text = Session["Val"].ToString()

    hth
    "mathieu cupryk" <> wrote in message
    news:#...
    > Can u demonstrate an example with say an textbox
    > txtEmail?
    >
    > *** Sent via Developersdex http://www.developersdex.com ***
    > Don't just participate in USENET...get rewarded for it!
    Alvin Bruney, Aug 24, 2003
    #4
    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. panik
    Replies:
    0
    Views:
    441
    panik
    Dec 4, 2003
  2. Stuart Redmann
    Replies:
    5
    Views:
    469
    Stuart Redmann
    Dec 14, 2007
  3. bdb112
    Replies:
    45
    Views:
    1,321
    jazbees
    Apr 29, 2009
  4. Jim
    Replies:
    1
    Views:
    848
    Aaron Bertrand - MVP
    Jan 28, 2004
  5. Replies:
    1
    Views:
    135
    Anthony Jones
    May 1, 2006
Loading...

Share This Page