用profile实现购物车
在product.aspx中GridView数据绑定数据库 `后跟一个购买按钮 代码如下:
protected void AddCartItem(object sender, EventArgs e)
{
//获取选择的行
GridViewRow row = ProductGird .SelectedRow ;
//获取选择的行ID
int ID = (int)ProductGird.SelectedDataKey.Value;
string Brand = row.Cells[1].Text;
string Name = row.Cells[2].Text;
decimal MarketPrice = Decimal.Parse(row.Cells[3].Text, System.Globalization.NumberStyles.Currency);
decimal StationPrice = Decimal.Parse(row.Cells[4].Text, System.Globalization.NumberStyles.Currency);
if (Profile.ShoppingCart == null) //如果购物车中无此项就添加
{
Profile.ShoppingCart = new ShoppingCart();
}
Profile.ShoppingCart.Additem(ID, Name, Brand, MarketPrice, StationPrice); //添加到profile中
}按下后`物品已经加到购物车中`但页面还是停在product.aspx中`如何让他自己跳过去?
在product.aspx中GridView数据绑定数据库 `后跟一个购买按钮 代码如下:
protected void AddCartItem(object sender, EventArgs e)
{
//获取选择的行
GridViewRow row = ProductGird .SelectedRow ;
//获取选择的行ID
int ID = (int)ProductGird.SelectedDataKey.Value;
string Brand = row.Cells[1].Text;
string Name = row.Cells[2].Text;
decimal MarketPrice = Decimal.Parse(row.Cells[3].Text, System.Globalization.NumberStyles.Currency);
decimal StationPrice = Decimal.Parse(row.Cells[4].Text, System.Globalization.NumberStyles.Currency);
if (Profile.ShoppingCart == null) //如果购物车中无此项就添加
{
Profile.ShoppingCart = new ShoppingCart();
}
Profile.ShoppingCart.Additem(ID, Name, Brand, MarketPrice, StationPrice); //添加到profile中
}按下后`物品已经加到购物车中`但页面还是停在product.aspx中`如何让他自己跳过去?
显示是否跳到购物车? 但window.showModelessDialog() 不能使用`初学不到家`望高人指点一二....
Response.Ridirect("XXX.aspx");