Powered by Blogger.

Thursday, March 13, 2014

Cross-page posting in Asp.Net

In this post we will discuss about cross page posting in asp.net.

You can also check my previous posts on:

- Data Binding and Graphics in WPF

- How to download file in C#.Net?

- How to disable right click by using jQuery in asp.net?

- Cross page posting helps send data from one page to another in Asp.Net. This helps the postback mechanism.

- This can be achieved by a proerty name as PostBackUrl, which is defined by the IButtonControl interface. Its available for controls like ImageButton, LinkButton, and Button etc.

- To use cross-posting, you simply set PostBackUrl to the name of another web form. When the user clicks the button, the page will be posted to that new URL with the values from all the input controls on the current page.

<asp:Button runat="server" ID="btnClick" PostBackUrl="Page2.aspx" Text="Cross-Page Postback" />

To retrieve the value in the second page, write like below:

protected void Page_Load(object sender, EventArgs e)
if (PreviousPage != null)
string previousPageTitle = PreviousPage.Title;

This page is meant for single page only.