Whenever you execute a Cross Page Post-Back from one site to another by using
<asp:button PostBackUrl=“anotherpage.aspx" runat=“server"/>
be sure to set this on anotherpage.aspx to gain full access to the controls of the previous page:
<%@ PreviousPage VirtualPath=“previouspage.aspx" %>
Afer that, you can access the controls by using the Page.PreviousPage Property.
Example:
Textbox MyNewTextBox = PreviousPage.FindControl("PreviousPageTextBox");
Label1.Text = MyNewTextBox.Text;
Cheers!
5 comments ↓
I added this and I see “Parser Error Message: The directive ‘previouspage’ is unknown.”. Is there something else required for this directive to work?
Hi Kevin, please show me your complete code.
Working great Andreas, thanks for the tipp!
PreviousPageType not PreviousPage
hi all coder..i m using
RadioButton rd = (RadioButton)PreviousPage.FindControl(“RadioButton3”);// (RadioButton)Panel1.PreviousPage.FindControl(“RadioButton3”) as RadioButton;
if (rd.Checked == true)
{
Reset.Visible = false;
}
error object can not find instance of an object ..pls tell me solution thanxx
Leave a Comment