ASP.NET by default Submits the Form to the same page. Cross Page Posting is submitting the form on different page. this is actually needed when you are creating a multipage form to collect information of the user on each page. When moving from the source to the Target page, the values of control in the source page can be accessed in the target page. Cross Page Posting feature allows a page to Cross Post to another page which in turn allows you to access all data in Posted Source Page.To use Cross Page Posting you have to use the PostBackURL attribute to specify the Page you want to post to. Here I am discussing an example in which I am describing the Cross Page Posting or PostBack in ASP.NET using VB.NET. I have taken two TextBoxes and one Button control, Button click will Post Back to another page and their you will retrieve and show values of both TextBoxes. Steps for implementation:-
<%@ Page Title="Home Page" Language="vb" MasterPageFile="~/Site.Master" AutoEventWireup="false" CodeBehind="Default.aspx.vb" Inherits="WebApplication7._Default" %> <asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent"></asp:Content><asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent"> <h1> First Name: <asp:TextBox ID="txtFirstName" runat="server"></asp:TextBox> </h1> <h1> Last Name: <asp:TextBox ID="txtLastName" runat="server"></asp:TextBox> </h1> <p> </p> <asp:Button ID="Button1" runat="server" Text="Button" PostBackUrl="~/Default2.aspx" /></asp:Content>
Understanding Cross Page Posting in ASP.NET using VB.NET
How to work with PlaceHolder in ASP.NET using VB.NET