aspnet超级链接 传递 当前页面 textbox值

一共有两个窗体、 第一个窗体A传参到窗体B  A的参数是A窗体的textbox
窗体A代码
 1 <html xmlns="http://www.w3.org/1999/xhtml">
 2 <head runat="server">
 3     <title></title>
 4     <script type="text/javascript">
 5         function test() {
 6             var gysvalue = document.getElementById("txtgys").value;
 7             var thvalue = document.getElementById("txtth").value;
 8             document.getElementById("a").href = "DataDemo.aspx?txtgys=" + gysvalue + "&txtth=" + thvalue;
 9         }
10     </script>
11 </head>
12 <body>
13 <table>
14     <tr>
15             <td>
16                 供应商<asp:TextBox ID="txtgys" runat="server"></asp:TextBox>
17             </td>
18             <td>
19                 图号<asp:TextBox ID="txtth" runat="server"></asp:TextBox>
20             </td>
21             <td>
22                 &nbsp;</td>
23         </tr>
24 </table>
25 </body>
26 <a href="#" id="a" target="_blank" onclick ="test();"><<查询>></a>
View Code

窗体B代码

 1 <html xmlns="http://www.w3.org/1999/xhtml">
 2 <head runat="server">
 3     <title></title>
 4 </head>
 5 <body>
 6     <form id="form1" runat="server">
 7    
19     <div>
20     
21         <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
22         <br />
23     
24     </div>
25     <div>
26     
27         <asp:Label ID="Label2" runat="server" Text="Label"></asp:Label>
28         <br />
29     
30     </div>
31     </form>
32 </body>
33 </html>

窗体B  cs 代码

1  protected void Page_Load(object sender, EventArgs e)
2     {
3         Label1.Text = Request.QueryString["txtgys"].ToString();
4         Label2.Text = Request.QueryString["txtth"].ToString();
5    
6     }

 

转载于:https://www.cnblogs.com/fengwei0813/p/5417130.html

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值