且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

< asp:Button>中PostBackUrl的目的

更新时间:2022-11-30 12:11:03

如果您未指定条目 PostBackUrl ,则按钮会将数据提交回同一页面,在这种情况下, cart.aspx .

If you do not specify the entry PostBackUrl, the button will submit the data back to the same page, in your case it is cart.aspx.

PostBackUrl 的目的是对数据进行跨页发布.

The purpose of PostBackUrl is a across-page-posting of data.

如果您指定 PostBackUrl =〜/Order.aspx" ,您的数据将被发布回您的 Order.aspx 页面.在 Order.aspx 页面中,您将能够使用以下命令获取 TextBox (位于 cart.aspx 中)数据:

If you specify PostBackUrl="~/Order.aspx", your data will be posted back to your Order.aspx page. In your Order.aspx page, you will be able to get your TextBox (which was in cart.aspx) data using:

Page.PreviousPage.FindControl("TextBox1")

您可以在 https://msdn.microsoft.com/上了解更多信息.zh-CN/library/ms178139.aspx