bufeng813

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     }

 

posted on 2016-04-21 15:28  bufeng813  阅读(367)  评论(0编辑  收藏  举报

导航