Reputation: 8879
In my page when edit button pressed it should go to edit page with filled form elements
if (e.CommandName == "edit")
{
dataaccess.Instance.get(Convert.ToInt32(e.CommandArgument));
//code here
}
How redirect to another page with a value(e.g id)
Upvotes: 0
Views: 1541
Reputation: 83
Just pass the value from First page using Query String
Response.Redirect("thankyou.aspx?id="+e.CommandArgument);
And get the value in other page's page load method using
string ID = Request.QueryString["ID"].ToString();
It's the easiest way to pass and get the variable between page but Query string is visible in Address bar chances of hacking or SQL Injection is more.
For that you can Encrypt the Query String before pass it in URL.
OR
You can use Session Variable too. which is more secure than Query String.
Upvotes: 1