我正在开发一个Asp.Net C#购物网站我有一个Productdetils页面有一个图像按钮添加到购物车。我想如果用户单击按钮选择产品进入购物车,Aspx使用A ... [英] I Am Devoloping An Asp.Net C# Shoping Website Where I Have A Productdetils Page There Is A Image Button Add To Cart . I Want If User Click The Button The Select Products Goes To Cart,Aspx Using A...

查看:108
本文介绍了我正在开发一个Asp.Net C#购物网站我有一个Productdetils页面有一个图像按钮添加到购物车。我想如果用户单击按钮选择产品进入购物车,Aspx使用A ...的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个asp.net c#购物网站,我有一个productdetils页面,有一个图像按钮添加到购物车。我想如果用户点击按钮,选择产品去购物车,aspx使用sassion。我只使用一个表products.splz帮助代码

i am devoloping an asp.net c# shoping website where i have a productdetils page there is a image button add to cart . i want if user click the button the select products goes to cart,aspx using a sassion. i am using only one table products..plz help with code

推荐答案

在你的代码中定义一个字典(Dictionary< string,list>< string>>)作为包含userid和产品ID列表的公共属性。



In your code define a dictionary (Dictionary<string,list><string>>) as a public property which will contain userid and a list of product ids.

public Dictionary<string, List<string>> SavedProducts
       {
           get {
               return Session["SavedProducts"] == null
                    ? (Dictionary<string, List<string>>)Session["SavedProducts"]
                    : new Dictionary<string, List<string>>();
           }
           set { Session["SavedProducts"] = value; }



}



把它放在你的母版页或基页上你应该没事。

请务必在结账后清除特定用户的收藏。


}

put that on your master page or base page and you should be fine.
Remember to clear the collection for a specific user after checkout.


这篇关于我正在开发一个Asp.Net C#购物网站我有一个Productdetils页面有一个图像按钮添加到购物车。我想如果用户单击按钮选择产品进入购物车,Aspx使用A ...的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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