Server.Transfer Second Parameter Set To True?

M

mathieu cupryk

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>
 
A

Alvin Bruney

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
 
A

Alvin Bruney

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
 

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,768
Messages
2,569,575
Members
45,053
Latest member
billing-software

Latest Threads

Top