I'm trying to make a survey consists of 2 pages. I wrote the code for the first page to store every answer for a question in session object. So that when the user hits "Back" from the second page, the first one will view the stored values.
The problem is it doesn't work. Please help.
PS: I know it's a stupid way, but it's a homework. Thank's ;)
Here is the code.
2006-10-30
04:11:53
·
1 answers
·
asked by
Doublethink..!!
1
in
Computers & Internet
➔ Programming & Design
public partial class travel : System.Web.UI.Page
{
string nextVacation;
string vacationType;
string budget;
protected void Page_Load(object sender, EventArgs e)
{
Label1.Text = Request.QueryString["surveyType"];
DropDownList1.SelectedValue = nextVacation;
ListBox1.SelectedValue = vacationType;
TextBox1.Text = budget;
}
protected void Button1_Click(object sender, EventArgs e)
{
Session["nextVacation"] = DropDownList1.SelectedItem;
Session["vacationType"] = ListBox1.SelectedItem;
Session["budget"] = TextBox1.Text;
Response.Redirect("travel2.aspx?surveyType=" + Label1.Text);
}
}
2006-10-30
04:12:21 ·
update #1