Click here to Skip to main content
15,921,884 members

Comments by Arshad Jugon (Top 1 by date)

Arshad Jugon 18-Apr-13 13:13pm View    
I tried it works, but the same error popped up at another place.

here -> if (LocalCart.Rows.Count == 0) [Same Error]

my updated code

protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{


DataTable LocalCart = new DataTable();
LocalCart = (DataTable)Session["cart"];
int LocalCartItemCount = Session["CartItemCount"] == null ? 0 : Convert.ToInt32(Session["CartItemCount"]);
Decimal LocalCartAmount = Session["CartAmount"] == null ? 0 : Convert.ToDecimal(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);
}
}
}