Visual Studio .NET - Ok, I need u're help. To save the items if I,,,

Asked By matt cupryk on 27-Jan-04 02:27 PM
If I click back to previous page. How can these values be saved.
using System; 
using System.Collections; 
using System.Collections.Specialized; 
using System.ComponentModel; 
using System.Data; 
using System.Drawing; 
using System.Web; 
using System.Web.SessionState; 
using System.Web.UI; 
using System.Web.UI.WebControls; 
using System.Web.UI.HtmlControls; 
using System.Net; 
using System.Text; 
using System.Xml; 
using System.Threading; 
using System.Data.SqlClient; 
using System.Globalization; 
using System.Text.RegularExpressions; 
using System.Configuration; 
namespace CuprykWeb 
{ 
    // <summary> 
/// Summary description for WebForm2. 
/// </summary> 
public class physicalcharacterics : System.Web.UI.Page 
{ 
protected System.Web.UI.HtmlControls.HtmlInputImage InputImage7; 
protected System.Web.UI.WebControls.ListBox lbPiercing; 
protected System.Web.UI.WebControls.ListBox lbJewelry; 
protected System.Web.UI.WebControls.ListBox lbTattoo; 
protected System.Web.UI.WebControls.ListBox lbFashionSense; 
protected System.Web.UI.WebControls.ListBox lbFacialHair; 
protected System.Web.UI.WebControls.ListBox lbFacialShape; 
protected System.Web.UI.WebControls.ListBox lbEyeColor; 
protected System.Web.UI.WebControls.ListBox lbEyeWear; 
protected System.Web.UI.WebControls.ListBox lbWeight; 
protected System.Web.UI.WebControls.ListBox lbHeight; 
protected System.Web.UI.WebControls.ListBox lbHairColor; 
protected System.Web.UI.WebControls.ListBox lbHairStyle; 
protected System.Web.UI.WebControls.ListBox lbComplexion; 
protected System.Web.UI.WebControls.ListBox lbBodyType; 
protected System.Web.UI.WebControls.ListBox lbAppearance; 
protected System.Web.UI.WebControls.ListBox lbEthnicBackground; 
protected System.Web.UI.WebControls.ListBox lbNationality; 
protected MetaBuilders.WebControls.FirstFocus FirstFocus1; 
protected System.Web.UI.HtmlControls.HtmlInputImage InputImage6; 
static string m_strConnection = System.Configuration.ConfigurationSettings.AppSettings["sRegistration_FormDBConnectionString"]; // default connection string 
static string batchSQL = "Select * FROM nationalities; Select * FROM ethnicbackgrounds; Select * FROM appearances; Select * FROM bodytypes; Select * FROM complexions; Select * FROM hairstyles; Select * FROM haircolors; Select * FROM heights; Select * FROM weights; Select * FROM eyewears; Select * FROM eyecolors; Select * FROM facialshapes; Select * FROM facialhairs; Select * FROM fashionsenses; Select * FROM tattoos; Select * FROM jewelrys; Select * FROM piercings"; 
static SqlDataAdapter title; 
// create a SqlDataAdapter and use it to fill a DataSet SqlDataAdapter title; 
//********************************************************************************* 
public void lbAppearance_SelectedIndexChanged(object sender, EventArgs e) 
{ 
if (lbAppearance.SelectedItem != null) 
{ 
Session["webform2_lbAppearance"] = lbAppearance.SelectedValue; 
} 
} 
//********************************************************************************* 
public void lbBodyType_SelectedIndexChanged(object sender, EventArgs e) 
{ 
if (lbBodyType.SelectedItem != null) 
{ 
Session["webform2_lbBodyType"] = lbBodyType.SelectedValue; 
} 
} 
//********************************************************************************* 
public void lbNationality_SelectedIndexChanged(object sender, EventArgs e) 
{ 
if (lbNationality.SelectedItem != null) 
{ 
Session["webform2_lbNationality"] = lbNationality.SelectedValue; 
} 
} 
//********************************************************************************* 
public void lbHeight_SelectedIndexChanged(object sender, EventArgs e) 
{ 
if (lbHeight.SelectedItem != null) 
{ 
Session["webform2_lbHeight"] = lbHeight.SelectedValue; 
} 
} 
//********************************************************************************* 
public void lbWeight_SelectedIndexChanged(object sender, EventArgs e) 
{ 
if (lbWeight.SelectedItem != null) 
{ 
Session["webform2_lbWeight"] = lbWeight.SelectedValue; 
} 
} 
//********************************************************************************* 
public void lbHairStyle_SelectedIndexChanged(object sender, EventArgs e) 
{ 
if (lbHairStyle.SelectedItem != null) 
{ 
Session["webform2_lbHairStyle"] = lbHairStyle.SelectedValue; 
} 
} 
//********************************************************************************* 
public void lbHairColor_SelectedIndexChanged(object sender, EventArgs e) 
{ 
if (lbHairColor.SelectedItem != null) 
{ 
Session["webform2_lbHairColor"] = lbHairColor.SelectedValue; 
} 
} 
//********************************************************************************* 
public void lbEyeWear_SelectedIndexChanged(object sender, EventArgs e) 
{ 
if (lbEyeWear.SelectedItem != null) 
{ 
Session["webform2_lbEyeWear"] = lbEyeWear.SelectedValue; 
} 
} 
//********************************************************************************* 
public void lbEyeColor_SelectedIndexChanged(object sender, EventArgs e) 
{ 
if (lbEyeColor.SelectedItem != null) 
{ 
Session["webform2_lbEyeColor"] = lbEyeColor.SelectedValue; 
} 
} 
//********************************************************************************* 
public void lbComplexion_SelectedIndexChanged(object sender, EventArgs e) 
{ 
if (lbComplexion.SelectedItem != null) 
{ 
Session["webform2_lbComplexion"] = lbComplexion.SelectedValue; 
} 
} 
//********************************************************************************* 
public void lbFacialShape_SelectedIndexChanged(object sender, EventArgs e) 
{ 
if (lbFacialShape.SelectedItem != null) 
{ 
Session["webform2_lbFacialShape"] = lbFacialShape.SelectedValue; 
} 
} 
//********************************************************************************* 
public void lbFacialHair_SelectedIndexChanged(object sender, EventArgs e) 
{ 
if (lbFacialHair.SelectedItem != null) 
{ 
Session["webform2_lbFacialHair"] = lbFacialHair.SelectedValue; 
} 
} 
//********************************************************************************* 
public void lbEthnicBackground_SelectedIndexChanged(object sender, EventArgs e) 
{ 
if (lbEthnicBackground.SelectedItem != null) 
{ 
Session["webform2_lbEthnicBackground"] = lbEthnicBackground.SelectedValue; 
} 
} 
//********************************************************************************* 
public void lbJewelry_SelectedIndexChanged(object sender, EventArgs e) 
{ 
if (lbJewelry.SelectedItem != null) 
{ 
Session["webform2_lbJewelry"] = lbJewelry.SelectedValue; 
} 
} 
//********************************************************************************* 
public void lbFashionSense_SelectedIndexChanged(object sender, EventArgs e) 
{ 
if (lbFashionSense.SelectedItem != null) 
{ 
Session["webform2_lbFashionSense"] = lbFashionSense.SelectedValue; 
} 
} 
//********************************************************************************* 
public void lbTattoo_SelectedIndexChanged(object sender, EventArgs e) 
{ 
if (lbTattoo.SelectedItem != null) 
{ 
Session["webform2_lbTattoo"] = lbTattoo.SelectedValue; 
} 
} 
//********************************************************************************* 
public void lbPiercing_SelectedIndexChanged(object sender, EventArgs e) 
{ 
if (lbPiercing.SelectedItem != null) 
{ 
Session["webform2_lbpiercing"] = lbPiercing.SelectedValue; 
} 
} 
public void BindList(ref System.Web.UI.WebControls.ListBox MyList, 
DataTable DataSource, 
string ValueColumnName, 
string TextColumnName 
) 
{ 
MyList.DataSource = DataSource; 
MyList.DataTextField = TextColumnName; 
MyList.DataValueField = ValueColumnName; 
MyList.DataBind(); 
} 
private void Page_Load(object sender, System.EventArgs e) 
{ 
Response.Expires=-1; 
// Proccess values from Form2 and store them 
if(!IsPostBack) 
{ 
    Thread.Sleep(5000); 
// Evals true first time browser hits the page 
DataSet ds = new DataSet(); 
title = new SqlDataAdapter (batchSQL, m_strConnection); 
title.Fill (ds); 
BindList(ref lbNationality, ds.Tables[0], "nationality_id", "nationality_name"); 
BindList(ref lbEthnicBackground,  ds.Tables[1], "ethnicbackground_id", "ethnicbackground_name"); 
BindList(ref lbAppearance,  ds.Tables[2], "appearance_id", "appearance_name"); 
BindList(ref lbBodyType,    ds.Tables[3], "bodytype_id", "bodytype_name"); 
BindList(ref lbComplexion,  ds.Tables[4], "complexion_id", "complexion_name"); 
BindList(ref lbHairStyle,   ds.Tables[5], "hairstyle_id", "hairstyle_name"); 
BindList(ref lbHairColor,   ds.Tables[6], "haircolor_id", "haircolor_name"); 
BindList(ref lbHeight,      ds.Tables[7], "height_id", "height_name"); 
BindList(ref lbWeight,      ds.Tables[8], "weight_id", "weight_name"); 
BindList(ref lbEyeWear,     ds.Tables[9], "eyewear_id", "eyewear_name"); 
BindList(ref lbEyeColor,    ds.Tables[10], "eyecolor_id", "eyecolor_name"); 
BindList(ref lbFacialShape, ds.Tables[11],"facialshape_id", "facialshape_name"); 
BindList(ref lbFacialHair,  ds.Tables[12],"facialhair_id", "facialhair_name"); 
BindList(ref lbFashionSense,ds.Tables[13],"fashionsense_id", "fashionsense_name"); 
BindList(ref lbTattoo,      ds.Tables[14], "tattoo_id", "tattoo_name"); 
BindList(ref lbJewelry,     ds.Tables[15], "jewelry_id", "jewelry_name"); 
BindList(ref lbPiercing,    ds.Tables[16], "piercing_id", "piercing_name"); 
} 
} // PageLoad 
        #region Web Form Designer generated code 
override protected void OnInit(EventArgs e) 
{ 
// 
// CODEGEN: This call is required by the ASP.NET Web Form Designer. 
// 
InitializeComponent(); 
base.OnInit(e); 
} 
/// <summary> 
/// Required method for Designer support - do not modify 
/// the contents of this method with the code editor. 
/// </summary> 
private void InitializeComponent() 
{ 
this.lbNationality.SelectedIndexChanged += new System.EventHandler(this.lbNationality_SelectedIndexChanged); 
this.lbEthnicBackground.SelectedIndexChanged += new System.EventHandler(this.lbEthnicBackground_SelectedIndexChanged); 
this.lbAppearance.SelectedIndexChanged += new System.EventHandler(this.lbAppearance_SelectedIndexChanged); 
this.lbBodyType.SelectedIndexChanged += new System.EventHandler(this.lbBodyType_SelectedIndexChanged); 
this.lbComplexion.SelectedIndexChanged += new System.EventHandler(this.lbComplexion_SelectedIndexChanged); 
this.lbHairStyle.SelectedIndexChanged += new System.EventHandler(this.lbHairStyle_SelectedIndexChanged); 
this.lbHairColor.SelectedIndexChanged += new System.EventHandler(this.lbHairColor_SelectedIndexChanged); 
this.lbHeight.SelectedIndexChanged += new System.EventHandler(this.lbHeight_SelectedIndexChanged); 
this.lbWeight.SelectedIndexChanged += new System.EventHandler(this.lbWeight_SelectedIndexChanged); 
this.lbEyeWear.SelectedIndexChanged += new System.EventHandler(this.lbEyeWear_SelectedIndexChanged); 
this.lbEyeColor.SelectedIndexChanged += new System.EventHandler(this.lbEyeColor_SelectedIndexChanged); 
this.lbFacialShape.SelectedIndexChanged += new System.EventHandler(this.lbFacialShape_SelectedIndexChanged); 
this.lbFacialHair.SelectedIndexChanged += new System.EventHandler(this.lbFacialHair_SelectedIndexChanged); 
this.lbFashionSense.SelectedIndexChanged += new System.EventHandler(this.lbFashionSense_SelectedIndexChanged); 
this.lbTattoo.SelectedIndexChanged += new System.EventHandler(this.lbTattoo_SelectedIndexChanged); 
this.lbJewelry.SelectedIndexChanged += new System.EventHandler(this.lbJewelry_SelectedIndexChanged); 
this.lbPiercing.SelectedIndexChanged += new System.EventHandler(this.lbPiercing_SelectedIndexChanged); 
this.InputImage7.ServerClick += new System.Web.UI.ImageClickEventHandler(this.InputImage7_ServerClick); 
this.Load += new System.EventHandler(this.Page_Load); 
} 
#endregion 
       public void InputImage6_ServerClick(object sender, System.Web.UI.ImageClickEventArgs e) 
{ 
Server.Transfer("signup.aspx", true); 
} 
public void InputImage7_ServerClick(object sender, System.Web.UI.ImageClickEventArgs e) 
{ 
Server.Transfer("personalitytraits.aspx", true); 
} 
    } 
}

If I understand you correctly, you don't

Asked By Robbe Morris on 27-Jan-04 04:20 PM
If you mean, how to I save these values if the user clicks the "back" button while on the data entry form, you can't.  The "back" button doesn't trigger a post back to the server.  Type this in google and get examples of how to disable the back button:
javascript disable back button

Losing the values when on the next page

Asked By matt cupryk on 28-Jan-04 01:04 AM
I am on the next page and when I come back to this page.
I want to keep the values in the listbox I illustrate an example on lbNationality.
Say I am on webform 3 then I want to go back to this page?
webform2:
Can someone help me out. 
<code
using System;
using System.Collections;
using System.Collections.Specialized;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Net;
using System.Text;
using System.Xml;
using System.Threading;
using System.Data.SqlClient;
using System.Globalization;
using System.Text.RegularExpressions;
using System.Configuration;
namespace CuprykWeb
{
    // <summary>
	/// Summary description for WebForm2.
	/// </summary>
	public class physicalcharacterics : System.Web.UI.Page
	{
		protected System.Web.UI.HtmlControls.HtmlInputImage InputImage7;
		protected System.Web.UI.WebControls.ListBox lbPiercing;
		protected System.Web.UI.WebControls.ListBox lbJewelry;
		protected System.Web.UI.WebControls.ListBox lbTattoo;
		protected System.Web.UI.WebControls.ListBox lbFashionSense;
		protected System.Web.UI.WebControls.ListBox lbFacialHair;
		protected System.Web.UI.WebControls.ListBox lbFacialShape;
		protected System.Web.UI.WebControls.ListBox lbEyeColor;
		protected System.Web.UI.WebControls.ListBox lbEyeWear;
		protected System.Web.UI.WebControls.ListBox lbWeight;
		protected System.Web.UI.WebControls.ListBox lbHeight;
		protected System.Web.UI.WebControls.ListBox lbHairColor;
		protected System.Web.UI.WebControls.ListBox lbHairStyle;
		protected System.Web.UI.WebControls.ListBox lbComplexion;
		protected System.Web.UI.WebControls.ListBox lbBodyType;
		protected System.Web.UI.WebControls.ListBox lbAppearance;
		protected System.Web.UI.WebControls.ListBox lbEthnicBackground;
		protected System.Web.UI.WebControls.ListBox lbNationality;
		protected MetaBuilders.WebControls.FirstFocus FirstFocus1;
		protected System.Web.UI.HtmlControls.HtmlInputImage InputImage6;
		static string m_strConnection = System.Configuration.ConfigurationSettings.AppSettings["sRegistration_FormDBConnectionString"];	//	default connection string
		static string batchSQL = "Select * FROM nationalities; Select * FROM ethnicbackgrounds; Select * FROM appearances; Select * FROM bodytypes; Select * FROM complexions; Select * FROM hairstyles; Select * FROM haircolors; Select * FROM heights; Select * FROM weights; Select * FROM eyewears; Select * FROM eyecolors; Select * FROM facialshapes; Select * FROM facialhairs; Select * FROM fashionsenses; Select * FROM tattoos; Select * FROM jewelrys; Select * FROM piercings";
		static SqlDataAdapter title;
		// create a SqlDataAdapter and use it to fill a DataSet SqlDataAdapter title; 
		//*********************************************************************************
		public void lbAppearance_SelectedIndexChanged(object sender, EventArgs e)
		{
			if (lbAppearance.SelectedItem != null)
			{
				Session["webform2_lbAppearance"] = lbAppearance.SelectedValue;
			}
		}
		//*********************************************************************************
		public void lbBodyType_SelectedIndexChanged(object sender, EventArgs e)
		{
			if (lbBodyType.SelectedItem != null)
			{
				Session["webform2_lbBodyType"] = lbBodyType.SelectedValue;
			}
		}
		//*********************************************************************************
		public void lbNationality_SelectedIndexChanged(object sender, EventArgs e)
		{
			if (lbNationality.SelectedItem != null)
			{
				Session["webform2_lbNationality"] = lbNationality.SelectedValue;
			}
		}
		//*********************************************************************************
		public void lbHeight_SelectedIndexChanged(object sender, EventArgs e)
		{
			if (lbHeight.SelectedItem != null)
			{
				Session["webform2_lbHeight"] = lbHeight.SelectedValue;
			}
		}
		//*********************************************************************************
		public void lbWeight_SelectedIndexChanged(object sender, EventArgs e)
		{
			if (lbWeight.SelectedItem != null)
			{
				Session["webform2_lbWeight"] = lbWeight.SelectedValue;
			}
		}
		//*********************************************************************************
		public void lbHairStyle_SelectedIndexChanged(object sender, EventArgs e)
		{
			if (lbHairStyle.SelectedItem != null)
			{
				Session["webform2_lbHairStyle"] = lbHairStyle.SelectedValue;
			}
		}
		//*********************************************************************************
		public void lbHairColor_SelectedIndexChanged(object sender, EventArgs e)
		{
			if (lbHairColor.SelectedItem != null)
			{
				Session["webform2_lbHairColor"] = lbHairColor.SelectedValue;
			}
		}
		//*********************************************************************************
		public void lbEyeWear_SelectedIndexChanged(object sender, EventArgs e)
		{
			if (lbEyeWear.SelectedItem != null)
			{
				Session["webform2_lbEyeWear"] = lbEyeWear.SelectedValue;
			}
		}
		//*********************************************************************************
		public void lbEyeColor_SelectedIndexChanged(object sender, EventArgs e)
		{
			if (lbEyeColor.SelectedItem != null)
			{
				Session["webform2_lbEyeColor"] = lbEyeColor.SelectedValue;
			}
		}
		//*********************************************************************************
		public void lbComplexion_SelectedIndexChanged(object sender, EventArgs e)
		{
			if (lbComplexion.SelectedItem != null)
			{
				Session["webform2_lbComplexion"] = lbComplexion.SelectedValue;
			}
		}
		//*********************************************************************************
		public void lbFacialShape_SelectedIndexChanged(object sender, EventArgs e)
		{
			if (lbFacialShape.SelectedItem != null)
			{
				Session["webform2_lbFacialShape"] = lbFacialShape.SelectedValue;
			}
		}
		//*********************************************************************************
		public void lbFacialHair_SelectedIndexChanged(object sender, EventArgs e)
		{
			if (lbFacialHair.SelectedItem != null)
			{
				Session["webform2_lbFacialHair"] = lbFacialHair.SelectedValue;
			}
		}
		//*********************************************************************************
		public void lbEthnicBackground_SelectedIndexChanged(object sender, EventArgs e)
		{
			if (lbEthnicBackground.SelectedItem != null)
			{
				Session["webform2_lbEthnicBackground"] = lbEthnicBackground.SelectedValue;
			}
		}
		//*********************************************************************************
		public void lbJewelry_SelectedIndexChanged(object sender, EventArgs e)
		{
			if (lbJewelry.SelectedItem != null)
			{
				Session["webform2_lbJewelry"] = lbJewelry.SelectedValue;
			}
		}
		//*********************************************************************************
		public void lbFashionSense_SelectedIndexChanged(object sender, EventArgs e)
		{
			if (lbFashionSense.SelectedItem != null)
			{
				Session["webform2_lbFashionSense"] = lbFashionSense.SelectedValue;
			}
		}
		//*********************************************************************************
		public void lbTattoo_SelectedIndexChanged(object sender, EventArgs e)
		{
			if (lbTattoo.SelectedItem != null)
			{
				Session["webform2_lbTattoo"] = lbTattoo.SelectedValue;
			}
		}
		//*********************************************************************************
		public void lbPiercing_SelectedIndexChanged(object sender, EventArgs e)
		{
			if (lbPiercing.SelectedItem != null)
			{
				Session["webform2_lbpiercing"] = lbPiercing.SelectedValue;
			}
		}
		public void BindList(ref System.Web.UI.WebControls.ListBox MyList,
			DataTable DataSource,
			string ValueColumnName,
			string TextColumnName
			) 
		{ 
			MyList.DataSource = DataSource; 
			MyList.DataTextField = TextColumnName; 
			MyList.DataValueField = ValueColumnName; 
			MyList.DataBind(); 
		} 
		private void Page_Load(object sender, System.EventArgs e)
		{
			// Proccess values from Form2 and store them
			if(!IsPostBack)
			{ 
				if (Session["webform2_lbNationality"]!=null)
				{
					string iSelected =  Session["webform2_lbNationality"].ToString(); 
					ListItem itm;
					itm = lbNationality.Items.FindByValue(iSelected.ToString());
					if (itm!=null) itm.Selected=true;
				}
				Thread.Sleep(5000);
				// Evals true first time browser hits the page
				DataSet ds = new DataSet(); 
				title = new SqlDataAdapter (batchSQL, m_strConnection); 
				title.Fill (ds);
				BindList(ref lbNationality, ds.Tables[0], "nationality_id", "nationality_name"); 
				BindList(ref lbEthnicBackground,  ds.Tables[1], "ethnicbackground_id", "ethnicbackground_name"); 
				BindList(ref lbAppearance,  ds.Tables[2], "appearance_id", "appearance_name"); 
				BindList(ref lbBodyType,    ds.Tables[3], "bodytype_id", "bodytype_name"); 
				BindList(ref lbComplexion,  ds.Tables[4], "complexion_id", "complexion_name"); 
				BindList(ref lbHairStyle,   ds.Tables[5], "hairstyle_id", "hairstyle_name"); 
				BindList(ref lbHairColor,   ds.Tables[6], "haircolor_id", "haircolor_name"); 
				BindList(ref lbHeight,      ds.Tables[7], "height_id", "height_name"); 
				BindList(ref lbWeight,      ds.Tables[8], "weight_id", "weight_name"); 
				BindList(ref lbEyeWear,     ds.Tables[9], "eyewear_id", "eyewear_name"); 
				BindList(ref lbEyeColor,    ds.Tables[10], "eyecolor_id", "eyecolor_name"); 
				BindList(ref lbFacialShape, ds.Tables[11],"facialshape_id", "facialshape_name"); 
				BindList(ref lbFacialHair,  ds.Tables[12],"facialhair_id", "facialhair_name"); 
				BindList(ref lbFashionSense,ds.Tables[13],"fashionsense_id", "fashionsense_name"); 
				BindList(ref lbTattoo,      ds.Tables[14], "tattoo_id", "tattoo_name"); 
				BindList(ref lbJewelry,     ds.Tables[15], "jewelry_id", "jewelry_name"); 
				BindList(ref lbPiercing,    ds.Tables[16], "piercing_id", "piercing_name"); 
			}
		} // PageLoad
        #region Web Form Designer generated code
		override protected void OnInit(EventArgs e)
		{
			//
			// CODEGEN: This call is required by the ASP.NET Web Form Designer.
			//
			InitializeComponent();
			base.OnInit(e);
		}
		/// <summary>
		/// Required method for Designer support - do not modify
		/// the contents of this method with the code editor.
		/// </summary>
		private void InitializeComponent()
		{
			this.lbNationality.SelectedIndexChanged += new System.EventHandler(this.lbNationality_SelectedIndexChanged);
			this.lbEthnicBackground.SelectedIndexChanged += new System.EventHandler(this.lbEthnicBackground_SelectedIndexChanged);
			this.lbAppearance.SelectedIndexChanged += new System.EventHandler(this.lbAppearance_SelectedIndexChanged);
			this.lbBodyType.SelectedIndexChanged += new System.EventHandler(this.lbBodyType_SelectedIndexChanged);
			this.lbComplexion.SelectedIndexChanged += new System.EventHandler(this.lbComplexion_SelectedIndexChanged);
			this.lbHairStyle.SelectedIndexChanged += new System.EventHandler(this.lbHairStyle_SelectedIndexChanged);
			this.lbHairColor.SelectedIndexChanged += new System.EventHandler(this.lbHairColor_SelectedIndexChanged);
			this.lbHeight.SelectedIndexChanged += new System.EventHandler(this.lbHeight_SelectedIndexChanged);
			this.lbWeight.SelectedIndexChanged += new System.EventHandler(this.lbWeight_SelectedIndexChanged);
			this.lbEyeWear.SelectedIndexChanged += new System.EventHandler(this.lbEyeWear_SelectedIndexChanged);
			this.lbEyeColor.SelectedIndexChanged += new System.EventHandler(this.lbEyeColor_SelectedIndexChanged);
			this.lbFacialShape.SelectedIndexChanged += new System.EventHandler(this.lbFacialShape_SelectedIndexChanged);
			this.lbFacialHair.SelectedIndexChanged += new System.EventHandler(this.lbFacialHair_SelectedIndexChanged);
			this.lbFashionSense.SelectedIndexChanged += new System.EventHandler(this.lbFashionSense_SelectedIndexChanged);
			this.lbTattoo.SelectedIndexChanged += new System.EventHandler(this.lbTattoo_SelectedIndexChanged);
			this.lbJewelry.SelectedIndexChanged += new System.EventHandler(this.lbJewelry_SelectedIndexChanged);
			this.lbPiercing.SelectedIndexChanged += new System.EventHandler(this.lbPiercing_SelectedIndexChanged);
			this.InputImage7.ServerClick += new System.Web.UI.ImageClickEventHandler(this.InputImage7_ServerClick);
			this.Load += new System.EventHandler(this.Page_Load);
		}
		#endregion
      	public void InputImage6_ServerClick(object sender, System.Web.UI.ImageClickEventArgs e)
		{
			Server.Transfer("signup.aspx", true);
		}
		public void InputImage7_ServerClick(object sender, System.Web.UI.ImageClickEventArgs e)
		{
			Server.Transfer("personalitytraits.aspx", true);
		}
    }
}
</code>

Matt, pay attention this time

Asked By Robbe Morris on 28-Jan-04 07:43 AM
If the user hits the back button to go back to webform 2, it does NOT trigger a server side event for you to save this data.  As I said, you'd have to disable the back button in the browser.  Then, put a button on your page that posts the form to the server and then redirects them back to webform2.  Plus, webform3 would have to recognize the need to pull up the saved data either in session or the database.
You could put your form data in cookies.  This isn't particularly secure and you may also run out of space in the cookie.
another option....
Asked By Angela S on 28-Jan-04 11:37 AM
you could save values in hidden fields on your form in the OnPreRender method.  OnPreRender happens after all the events, just before the page gets rendered.
Here's what I do:
public class myClass{
  private   int      _currentPage;
  private   string _sortExpression;
  public myClass(){
    //Set default values
    _currentPage     = 0;
    _sortExpression = string.Empty;
  }
  protected override void OnInit(EventArgs e){
    if(Page.Request.Form.GetValues("CurrentPage") != null)
      this._currentPage = Convert.ToInt32(Page.Request.Form.GetValues("CurrentPage")[0]);
    if(Page.Request.Form.GetValues("SortExpression") != null)
      this._sortExpression = Page.Request.Form.GetValues("SortExpression")[0];
    base.OnInit(e);
  }
  protected override void OnPreRender(EventArgs e) {
    this.Controls.Add(new LiteralControl("<input type='hidden' name='SortExpression' value='" + this._sortExpression + "'>"));
    this.Controls.Add(new LiteralControl("<input type='hidden' name='CurrentPage' value='" + this._currentPage + "'>"));
    base.OnPreRender(e);
  }//End OnPreRender()
}//End myClass
Ok
Asked By matt cupryk on 28-Jan-04 01:00 PM
But this is the old way of doing it in asp?
yeah, but it works
Asked By Angela S on 28-Jan-04 01:06 PM
Also, I always post back to the same form, I don't have a new page for each time I click Submit.  I don't know how you're doing it. 
This is more reliable than using ViewState and Cookies work, but you might run out of space depending on how much info you need to store.