首页 > 代码库 > get传值

get传值

 

发送页:

1 <form id="form1" runat="server">
2 <div>
3 <asp:TextBox ID="TextBox1" runat="server">008</asp:TextBox>
4 <asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="进入get页面" />
5 </div>
6 </form>

发送页后台CS代码:

1 protected void Button1_Click(object sender, EventArgs e)
2 {
3     string name = TextBox1.Text;
4     Response.Redirect(string.Format("get.aspx?tableid={0}", tableid), false);
5 }

 接收页: 

1 <form id="form1" runat="server">
2     <div>
3          <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
4          <asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
5         <asp:TextBox ID="TextBox3" runat="server"></asp:TextBox>
6    </div>
7  </form>

 

接收页后台CS代码:

 1 protected void Page_Load(object sender, EventArgs e)
 2 {
 3     if (Request.QueryString["name"] != null)
 4     {
 5         this.TextBox1.Text = Request["tableid"];
 6         this.TextBox2.Text = Request.Params["tableid"];
 7         this.TextBox3.Text = Request.QueryString["tableid"];
 8     }
 9  
10 }