Cross Page Posting
Basically, cross-page posting means that you are posting form data to another page as opposed to posting form data back to the same page (as is the default in ASP.NET). This can be useful when you want to post data to another page and don't want to incur the overhead of reloading the current page simply to redirect the user to another page.
crosspage1.aspx
<asp:Label ID="Label1" runat="server" Text="I want to access by crosspage posting"></asp:Label>
<asp:Button ID="Button1" runat="server" Text="crosspage" PostBackUrl="~/crosspage2.aspx" />
<asp:Button ID="Button1" runat="server" Text="crosspage" PostBackUrl="~/crosspage2.aspx" />
crosspage2.aspx
if (PreviousPage != null && PreviousPage.IsCrossPagePostBack != null){
Label1.Text = "result of cross page posting : = " + ((Label)PreviousPage.FindControl("Label1")).Text;
}
Comments
Post a Comment