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

📄 cartsummary.ascx.cs

📁 这是一个基于asp.net的网上气球店
💻 CS
字号:
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class UserControl_CartSummary : System.Web.UI.UserControl
{
    protected void Page_Load(object sender, EventArgs e)
    {
        PopulateControls();
        string page = Request.AppRelativeCurrentExecutionFilePath;
        if (string.Compare(page, "~/ShoppingCart.aspx", true) == 0)
        {
            this.Visible = false;
        }
        else 
        {
            this.Visible = true;
        }
    }

    private void PopulateControls()
    {
        DataTable dt = ShoppingCartAccess.GetItems();
        if (dt.Rows.Count == 0)
        {
            this.cartSummayLabel.Text = "Your shopping cart is empty.";
            this.totalAmountLabel.Text = string.Format("{0:c}", 0);
            viewCartLink.Visible = false;
            list.Visible = false;
        }
        else 
        {
            list.Visible = true;
            list.DataSource = dt;
            list.DataBind();
            cartSummayLabel.Text = "Cart summary";
            viewCartLink.Visible = true;
            decimal amount = ShoppingCartAccess.GetTotalAmount();
            totalAmountLabel.Text = string.Format("{0:c}",amount);
        }
    }
}

⌨️ 快捷键说明

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