Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In with Facebook Sign In with Google Sign In with OpenID

Categories

We have migrated to a new platform! Please note that you will need to reset your password to log in (your credentials are still in-tact though). Please contact lee@programmersheaven.com if you have questions.
Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Cross Page Posting.

macuprykmacupryk Posts: 6Member
I have the following two pages. I am wondering how can I return back.
When I click on the back link to go to page one I want the values to be saved or in the textboxes. What is the appropriate way in visual studio 2005?

CrossPage1.aspx
===============
<%@ Page Language="C#" %>



Untitled Page















Enter some Text:
Enter more Text:

Submit Page





CrossPage2.aspx
===============
<%@ Page Language="C#" %>
<%@ PreviousPageType VirtualPath="CrossPage1.aspx" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">


void Page_Load(object sender, System.EventArgs e)
{
// If posted from CrossPage1.aspx to CrossPage2.aspx...

if (PreviousPage == null)
{
Response.Write("Invoke me only through cross-page posting.");
Response.End();
return;
}
else
{
// Retrieve the textbox values from FindControl
TextBox TextBox1;
TextBox TextBox2;
TextBox1 = (TextBox)PreviousPage.FindControl("TextBox1");
TextBox2 = (TextBox)PreviousPage.FindControl("TextBox2");
Response.Write(TextBox1.Text+"
"+TextBox2.Text+"
");
}


}




Page2




 



Back






Sign In or Register to comment.