Blog

Cross Page Posting In ASP.NET

Posted by Mahak Gupta Blogs | .NET 4.5 Feb 29, 2012
We use the concept of CrossPage Posting, when we collect the data from one web page and this data is used on another webpage.

We use the concept of CrossPage Posting, when we collect the data from one web page and this data is used on another webpage.

We use the PreviousPage property of the Page object to access the data from the first page.

We can access any of the controls of the previous page by using the FindControl Method.

Here we take an example in which we take a Label( Label1 ) to show the previos page data( txtfname) in it.

 

if (PreviousPage == null)

{

 Label1.Text="There are no data in the previous page";

}

else

{

 Label1.Text = ((TextBox)PreviousPage.FindControl("txtfname")).Text;

 }

 

 

Note:

The Crosspage posting occurs where there are any data avaliable in the previous page and if there is no data in the previous page we set it

if (PreviousPage == null)

so there are no cross page posting occurs in this case.

 

COMMENT USING
PREMIUM SPONSORS
Hire Mobile & Web Developer on demand. 100% satisfaction. Try for 1 week or Money Back. Local and remote developers available all over USA.
SPONSORED BY
  • MCN is your source for developing solutions involving websites, mobile apps, cloud-computing, databases, BI, back-end services and processes and client-server applications.