Aug 5, 2010

Passing Values Between Two ASP.Net pages

If you ARE NOT passing sensitive data, this may help.
Original page: 

protected void Button1_Click(object sender, EventArgs e) 
{       
   string MyOccupation = "Software Developer";           string url;
          url = "page2.aspx?occupation=" + MyOccupation;           Response.Redirect(url);
}

Next Page: 

string RetrievedValue;
protected void Page_Load(object sender, EventArgs e) 
{
          this.TextBox1.Text = Request.QueryString["occupation"];
          RetrievedValue = this.TextBox1.Text; 
}

No comments:

Post a Comment