Search code examples
asp.netpostwebformscross-page-postback

Post data to another aspx page


I have simple aspx page that has a form and a input field in it something like below.

//basket.aspx

<input type="text" id="TotalPrice" runat="server" name="TotalPrice" value="100" />

 <asp:button ID="btnBuy" runat="server" Text="make payment" PostBackUrl="~/payment" />

</form>

This is going to payment.aspx but when I debug the Request.Form in the page load of the payment.aspx, I cannot reach the TotalPrice value like Request.Form["TotalPrice"]. What is the best way to make a post to another aspx page to get values ? Why the way I am trying to does not work ?


Solution

  • You should be using PreviousPage property on the target page.

    Here is an article on how to make cross post backs work