Wednesday, August 18, 2010

Use Query String to pass values between pages

Example: http://...../form.aspx?param1=career¶m2=ride

First Page, Rediret page from text input:

private void ButtonSubmit_Click(object sender, eventArgs e)
{
Response.Redirect("form.aspx?param1="+this.Form.Text1.Text +"¶m2="
+this.Form.Text);
}

Second Read value from query string:

private void Page_Load(object sender, eventArgs e)
{
Text1.Text=Request.QueryString["Param1"];
Text2.Text=Request.QueryString["Param2"];
}

No comments: