添加到购物车计数显示 [英] add to cart count display

查看:105
本文介绍了添加到购物车计数显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




我在网上购物中做示例项目.如何在母版页中显示添加到购物车的数量.


我希望回复我


感谢和问候
sravan




iam doing sample project in online shopping. how to display add to cart count in masterpage.


i hope reply to me answer


thanks and regards
sravan

推荐答案

如果按订单收集产品ID,则会话,并以ID'',"分开,然后在母版页代码中设置标签的文本后面:
if you collecting in orders product id the session, and seprate in ID whit '','' and then set the text of a label in master page code behind:
lblcount.Text = Session["orderID"].ToString().Split(',').Count();


解决问题的方法太多,但是您必须说说收集用户订单的逻辑是什么.


there are too many ways to solve your problem but you have to say what is your logic to collecting users orders.


您好,

检查此链接.

母版页和内容页的交互 [
Hi,

Check this Link.

Master Page and Content Page Interaction[^]


在将商品添加到购物车和从购物车中删除项目时更新会话值.显示购物车上的价值,仅此而已.

添加项目
Update the Session value when you add/remove items to/from cart & show the value on cart, that''s all.

Add Items
private void AddItemsToCart()
{
//Code to be written
//blah blah blah
Session["Item"] = ItemCount;
}


删除项目


Remove Items

private void RemoveItemsFromCart()
{
//Code to be written
//blah blah blah
Session["Item"] = ItemCount;
}


在购物车标签上显示值


Display the value on Cart Label

lblItemCount.Text = Session["Item"].ToString();


这篇关于添加到购物车计数显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆