ASP.NET购物车实例

首页产品列表,使用的是DataList

Default.aspx

 

后台事件

Default.aspx.cs

 

 

购物车页面Cart.aspx

 

后台代码Cart.aspx.cs

 

 

想要代码的,可以到我的资源里去找,我用的是VS2010写的

经典的购物车系统: 关键词: Internet 网上书店开发 购书系统 开发一套网上购书系统,可以让顾客通过浏览器浏览网站售书目录,从而挑选自己满意的图书,并下订单购买。而网站后台人员需要维护网站会员信息、书籍信息以及订单信息。本系统的目的就是要开发一套既方便客户网上购书,又方便网站维护人员维护网站WEB服务系统。 用户信息显示: protected void Button1_Click(object sender, EventArgs e) { Book book =new Book(); DetailsViewRowCollection rows=DetailsView1.Rows; book.Bookname = rows[1].Cells[1].Text; book.Bookid =(String)rows[0].Cells[1].Text; book.Introduce = rows[8].Cells[1].Text; CartItem item = new CartItem(); item.Book = book; item.Quantity = Int32.Parse(TextBoxQuerty.Text); Profile.ShoppingCart.AddItem(item); Response.Redirect(@"~\products\CartInfor.aspx"); Labelnfor.Text ="Bookname"+ item.Book.Bookname+"<br/>数量:"+item.Quantity; } 订单生成: protected void Page_Load(object sender, EventArgs e) { ShowInfor(); } protected void Button1_Click(object sender, EventArgs e) { Response.Redirect(@"~\products\BookInforByCatalog.aspx"); } private void ShowInfor() { ListBox1.Items.Clear(); CartItem[] items = Profile.ShoppingCart.GetAllItems(); for (int i = 0; i < items.Length; ++i) { CartItem item =items[i]; String str = String.Format("Bookname:{0} Quantity:{1}",item.Book.Bookname,item.Quantity); ListBox1.Items.Add(str); } } protected void Button3_Click(object sender, EventArgs e) { ListBox1.Items.Remove(ListBox1.Items[index]); } protected void Button4_Click(object sender, EventArgs e) { ListBox1.Items.Clear(); } protected void Button2_Click(object sender, EventArgs e) { } }
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值