📄 addtocart.aspx
字号:
<%@ Page Language="vb" %>
<script language="VB" runat="server">
'*******************************************************
'
' The Page_Load event on this page is used to add the
' identified product to the user's shopping cart, and then immediately
' redirect to the shoppingcart page (this avoids problems were a user hits
' "refresh" and accidentally adds another product to the cart)
'
' The product to add to the cart is specified using
' a querystring argument to the page.
'
' Other source code to examine:
' Conference.ShoppingCart.GetShoppingCartID() Method
' Conference.ShoppingCart.AddItem() Method
'
'*******************************************************
Sub Page_Load(sender As Object, e As EventArgs)
If Request.Params("ProductID") <> Nothing Then
Dim cart As New Conference.ShoppingCartDB
' Obtain current user's shopping cart ID
Dim cartID as String = cart.GetShoppingCartId()
' Add Product Item to Cart
cart.AddItem(cartId, CInt(Request.Params("ProductID")), 1)
End If
Page.Navigate("ShoppingCart.aspx")
End Sub
</script>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -