Purpose of PostBackUrl in <asp:Button>

Viewed 7236

What's the purpose of using PostBackUrl?
Let's say I have a button which is in Cart.aspx:

 <asp:Button ID="btnContinue" runat="server" Text="Continue Shopping" PostBackUrl="~/Order.aspx"  CssClass="btn" />

That means that I will be redirectd to Order.aspx, rather than staying on original Cart.aspx. Here are my two questions:

  1. I also have a TextBox in Cart.aspx.
    When I click the button, the value of the TextBox will be posted back to Order.aspx rather than original Cart.aspx. Now I think we can only get this value if it is posted back to Cart.aspx, which contains this TextBox.
    What if I want to retrieve this value on the new page?

  2. If there is no way to retrieve any input on Cart.aspx, why do we need to use PostBackUrl? We could just add:

    Response.Redirect("~/Order.aspx") to the Cart.aspx.cs?

2 Answers
Related