get方式传值
发送页:
<form id="form1" runat="server"> <div> <asp:TextBox ID="TextBox1" runat="server">awei</asp:TextBox> <asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="进入WebForm1页面" /> </div> </form>
发送页后台CS代码:
protected void Button1_Click(object sender, EventArgs e) { string name = TextBox1.Text; Response.Redirect(string.Format("WebForm1.aspx?name={0}", name), false); }
接收页:
<form id="form1" runat="server">
<div>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
<asp:TextBox ID="TextBox3" runat="server"></asp:TextBox>
</div>
</form>
<div>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
<asp:TextBox ID="TextBox3" runat="server"></asp:TextBox>
</div>
</form>
接收页后台CS代码:
protected void Page_Load(object sender, EventArgs e) { if (Request.QueryString["name"] != null) { this.TextBox1.Text = Request["name"]; this.TextBox2.Text = Request.Params["name"]; this.TextBox3.Text = Request.QueryString["name"]; } }