这个错误不断出现,我似乎无法弄清楚它来自哪里。
if (!IsPostBack)
{
DataTable LocalCart = new DataTable();
LocalCart = (DataTable)Session["cart"];
int LocalCartItemCount = (int) Session["CartItemCount"];
Decimal LocalCartAmount = (Decimal)Session["CartAmount"];
if (LocalCart.Rows.Count == 0)
{
titleLabel.Text = "Your shopping cart is empty!";
GridCart.Visible = false;
updateButton.Enabled = false;
checkoutButton.Enabled = false;
totalAmountLabel.Text = String.Format("{0:c}", 0);
}
else
{
GridCart.DataSource = LocalCart;
GridCart.DataBind();
titleLabel.Text = "These are the products in your shopping cart:";
GridCart.Visible = true;
updateButton.Enabled = true;
checkoutButton.Enabled = true;
totalAmountLabel.Text = String.Format("{0:c}", LocalCartAmount);
}
这是说错误在这里->int LocalCartItemCount = (int) Session["CartItemCount"];