Click here to Skip to main content
15,888,461 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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
XML
<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"/>



C#
protected void Button1Paste_Click(object sender, EventArgs e)
       {

       }


Page B

ASP.NET
<asp:TextBox ID="TextBox2" runat="server" Height="150px" TextMode="MultiLine" Width="240px"></asp:TextBox>


C#
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!
Posted
Updated 6-Sep-15 23:13pm
v3

1 solution

 
Share this answer
 
Comments
Member 11765602 8-Sep-15 4:39am    
Hi, I use Session instead of FindControl and it works! Thanks a lot!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900