What is cross page posting
What is cross page posting?
By default, button controls in ASP.NET pages post back to the same page that contains
the button, where you can write an event handler for the post. In most cases this is the
desired behavior, but occasionaly you will also want to be able to post to another page in
your application. The Server.Transfer method can be used to move between pages, however
the URL doesn't change. Instead, the cross page posting feature in ASP.NET 2.0 allows
you to fire a normal post back to a different page in the application. In the target page,
you can then access the values of server controls in the source page that initiated the post
To use cross page posting, you can set the PostBackUrl property of a Button, LinkButton or ImageButton control, which specifies the target page. In the target page, you can then access the PreviousPage property to retrieve values from the source page. By default, the PreviousPage property is of type Page, so you must access controls using the FindControl method. You can also enable strongly-typed access to the source page by setting the @PreviousPageType directive in the target page to the virtual path or Type name of the source page.
Here is a step-by-step guide for implementing the cross-page post back using controls that implement the IButtonControl interface.
ć Create a Web Form and insert a Button control on it using the VS .NET designer.
ć Set the button's PostBackUrl property to the Web Form you want to post back. For instance in this case it is "nextpage.aspx"
<asp:Button ID="Button1" runat="server"
PostBackUrl="~/nextpage.aspx" Text="Post to nextpage" />
2007-10-23, 11659👍, 0💬
How do you locate the first X in a string txt? A) txt.find('X'); B) txt.locate('X'); C) txt.indexOf(...
Is Session_End event supported in all session modes ? Session_End event occurs only in Inproc mode...
What are the different accessibility levels defined in .NET ? Following are the five levels of acces...
What exactly happens when ASPX page is requested from Browser? Note: - Here the interviewer is expec...
Can static variables be declared in a header file? You can't declare a static variable without defin...