How to: Post ASP.NET Web Pages to a Different Page 

By default, controls on ASP.NET Web pages that cause a postback, such as the Button control, post back to the page for processing. However, you can configure controls to post to a different page. For example, you might be creating a multi-page form that collects different information on each page.

On the target page, you can read the values of controls or public properties from the source page. For more information, see Cross-Page Posting in ASP.NET Web Pages1.

To post an ASP.NET Web page to another page

  1. Add a button control to your Web page, such as a Button2, LinkButton3, or ImageButton4 control.

  2. Set the PostBackUrl5 property for the control to the URL of the page to which you want to post the ASP.NET Web page.

    The following code example illustrates a Button control that is configured to post to a page named TargetPage in the root of the Web site.

    <asp:Button 
      ID="Button1" 
      PostBackUrl="~/TargetPage.aspx"
      runat="server"
      Text="Submit" />
    

    For more information, see How to: Pass Values Between ASP.NET Web Pages6.

See Also

Links Table
1http://msdn.microsoft.com/en-us/library/ms178139(v=vs.80).aspx
2http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.button(v=vs.80).aspx
3http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.linkbutton(v=vs.80).aspx
4http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.imagebutton(v=vs.80).aspx
5http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.ibuttoncontrol.postbackurl(v=vs.80).aspx
6http://msdn.microsoft.com/en-us/library/6c3yckfw(v=vs.80).aspx
7http://msdn.microsoft.com/en-us/library/ms178141(v=vs.80).aspx
Community Content Add
Annotations FAQ