creating query string and binding the query string value in another page

Raj_Chennai
Posted by Raj_Chennai under ASP.NET category on | Points: 40 | Views : 1677
default.aspx
 <asp:TextBox ID="TextBox1" runat="server" ontextchanged="TextBox1_TextChanged"></asp:TextBox>
<asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="Button" />

place this code in default.aspx.cs
protected void Button1_Click(object sender, EventArgs e)
{
string s = TextBox1.Text;
Response.Redirect("Default2.aspx? name=" + s);
}

default2.aspx
<
asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
<asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="Button" />

place this code in default.aspx.cs
protected void Button1_Click(object sender, EventArgs e)
{
string s= Request.QueryString[0];
Label1.Text ="" +s;
}

Comments or Responses

Login to post response