Possible Duplicate:
How can I pass values from one form to another in Asp.net
Hi.
I want to pass some data from one page to another at asp.net how can I do this in asp.net?
Possible Duplicate:
How can I pass values from one form to another in Asp.net
Hi.
I want to pass some data from one page to another at asp.net how can I do this in asp.net?
You can use the QueryString, Session, or Cookies
Note. In all cases when reading the value from the corresponding collection, you need to validate if the object exists before consuming it. (check for null)
<a href="mysecondPage.aspx?customerID=43" >My Link</a>
protected void Page_Load(object sender, EventArgs e)
{
var c = this.Request.QueryString["customerID"];
}
protected void Page_Load(object sender, EventArgs e)
{
this.Session["customerID"] = 44;
}
protected void Page_Load(object sender, EventArgs e)
{
var c = (int)this.Session["customerID"];
}
protected void Page_Load(object sender, EventArgs e)
{
this.Response.Cookies["customerID"].Value = "43";
}
protected void Page_Load(object sender, EventArgs e)
{
var c = int.Parse(this.Request.Cookies["customerID"].Value);
}