⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 shoppingcart.ascx

📁 ASP.NET2.0(C#篇)经典教程的源码...本源码很好的实现了购物车....编码规范和类的设计具有很好的借鉴性!
💻 ASCX
字号:
<%@ Control Language="C#" AutoEventWireup="true" codefile="ShoppingCart.ascx.cs" Inherits="ShoppingCartControl" %>

<%@ import Namespace="Wrox.Commerce" %>

    <!--
    This grid isn't bound using a data source control, so we
    have to provide the two way binding ourselves, by handling the events
    -->
    <asp:GridView ID="CartGrid" Runat="server" AutoGenerateColumns="False" DataKeyNames="ProductID"
        OnRowEditing="CartGrid_RowEditing" OnRowUpdating="CartGrid_RowUpdating"
        OnRowDeleting="CartGrid_RowDeleting" OnRowCancelingEdit="CartGrid_RowCancelingEdit">
        <Columns>
            <asp:TemplateField>
                <ItemTemplate>
                    <asp:Image id="ProductImage" Runat="server" ImageUrl='<%# Eval("ProductImageURL", "~/ProductImages/thumb_{0}")%>' />
                </ItemTemplate>
            </asp:TemplateField>
            <asp:BoundField DataField="ProductName" HeaderText="Product" ReadOnly="True" />
            <asp:BoundField DataField="Quantity" HeaderText="Quantity" />
            <asp:BoundField DataField="Price" HeaderText="Price" DataFormatString="{0:c}" ReadOnly="True" />
            <asp:BoundField DataField="LineTotal" HeaderText="Total" DataFormatString="{0:c}" ReadOnly="True" />
            <asp:CommandField ShowEditButton="True" ShowDeleteButton="true"></asp:CommandField>
        </Columns>
        <EmptyDataTemplate>
            There is nothing in your shopping cart. You can buy items from the 
            <a href="shop.aspx">Shop</a>.
        </EmptyDataTemplate>
    </asp:GridView>

    <br />

    <asp:Panel ID="DiscountPanel" Runat="server" Visible="false">
        <asp:Label ID="SubTotalLabel" runat="server" /><br />
        <asp:Label ID="MemberDiscount" Runat="server" />
    </asp:Panel>
    <br />
    <asp:Label ID="TotalLabel" Runat="server" />

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -