无法将Page A TextBox1中的值传递给Page B TextBox2 [英] Unable to pass the value in Page A TextBox1 to Page B TextBox2
问题描述
我正在尝试通过点击页面A上的按钮将我的网页A,textBox1中的内容传递到网页B,textBox2,但未能这样做。
我的代码如下:
Page A
TextBox
< pre lang =xml> < td class = auto-style4 >
< asp:TextBox ID = < span class =code-keyword> TextBox1 runat = server 高度 = 179px < span class =code-attribute> TextMode = MultiLine 宽度 = 282px > < / asp:TextBox >
< / td >
按钮
< asp:按钮ID =Button1Pasterunat =serverPostBackUrl =〜/ PageB.aspx Font-Bold =TrueForeColor =BlackHeight =41pxText =将内容提交到页面BWidth =195pxOnClick =Button1Paste_Click/>
protected void Button1Paste_Click( object sender,EventArgs e)
{
}
Page B
< asp:TextBox ID = TextBox2 runat = server 高度 = 150px TextMode =温泉n> MultiLine 宽度 = 240px > < / asp:TextBox >
受保护 void Page_Load( object sender,EventArgs e)
{
TextBox2 =(TextBox)(PreviousPage.FindControl ( PageA));
}
页面A中的内容未能传递给页面B,任何人都可以帮助建议解决这个问题的方法?谢谢!
阅读如何:在ASP.NET Web窗体页面之间传递值 [ ^ ]
I'm trying to pass the content in my Webpage A, textBox1 to WebpageB, textBox2 by clicking a button at Page A, but failed to do so.
my code as follow :
Page A
TextBox
<td class="auto-style4">
<asp:TextBox ID="TextBox1" runat="server" Height="179px" TextMode="MultiLine" Width="282px"></asp:TextBox>
</td>
Button
<asp:Button ID="Button1Paste" runat="server" PostBackUrl="~/PageB.aspx" Font-Bold="True" ForeColor="Black" Height="41px" Text="Submit Content To Page B" Width="195px" OnClick="Button1Paste_Click"/>
protected void Button1Paste_Click(object sender, EventArgs e)
{
}
Page B
<asp:TextBox ID="TextBox2" runat="server" Height="150px" TextMode="MultiLine" Width="240px"></asp:TextBox>
protected void Page_Load(object sender, EventArgs e)
{
TextBox2 = (TextBox)(PreviousPage.FindControl("PageA"));
}
The content in Page A failed to pass to Page B, can anyone help to suggest a way to fix this? Thank you!
read How to: Pass Values Between ASP.NET Web Forms Pages[^]
这篇关于无法将Page A TextBox1中的值传递给Page B TextBox2的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!