item.GoodsID = Int32.Parse(GoodsView1.DataKeys[Int32.Parse(e.CommandArgument.ToString())].ToString()); // 这句老提示错误,请帮忙看看,
private OrderItemInfos GetOrderItemInformation(DataListCommandEventArgs e)
{
//当购物车没有任何信息时
OrderItemInfos item = new OrderItemInfos();
item.Date = DateTime.Now;
item.Number = 1;
//获取商品价格
Label price =(Label)GoodsView1.Items[Int32.Parse(e.Item.ItemIndex.ToString())].FindControl("price");
if (price == null)
{
//显示错误信息
Response.Write("<script>window.alert('数据错误')</script>");
return null;
}
item.Price = item.ItemTotalMoney = decimal.Parse(price.Text.Trim());
//获取商品ID
item.GoodsID = Int32.Parse(GoodsView1.DataKeys[Int32.Parse(e.CommandArgument.ToString())].ToString()); // 这句老提示错误,请帮忙看看,
//获取商品名称
item.GoodsName = e.CommandName;
return (item);
}