K
KevinGravelle
What is wrong with this picture?
I'm trying to set my shopping cart text on my home page using the
following function that is executed when the class is constructed:
protected string fnGetShoppingCartText()
{
if (Session["Cart"] != null)
{
ArrayList cart = (ArrayList)Session["Cart"];
int intItemCount = cart.Count;
if (intItemCount == 0)
{
return "Shopping Cart (Empty)";
}
else if (intItemCount == 1)
{
return "Shopping Cart (1 item)";
}
else
{
return "Shopping Cart (" + intItemCount + " items)";
}
}
else
{
return "Shopping Cart (Empty)";
}
}
-----
It fails on the line: ArrayList cart = (ArrayList)Session["Cart"];
I have EnableSessionState="true" set in the Page Directive.
I am using MS Visual Web Developer 2005 Express Edition. I am able to
reference this variable in other pages.
Your help is greatly appreciated.
Thank you,
Kevin G.
I'm trying to set my shopping cart text on my home page using the
following function that is executed when the class is constructed:
protected string fnGetShoppingCartText()
{
if (Session["Cart"] != null)
{
ArrayList cart = (ArrayList)Session["Cart"];
int intItemCount = cart.Count;
if (intItemCount == 0)
{
return "Shopping Cart (Empty)";
}
else if (intItemCount == 1)
{
return "Shopping Cart (1 item)";
}
else
{
return "Shopping Cart (" + intItemCount + " items)";
}
}
else
{
return "Shopping Cart (Empty)";
}
}
-----
It fails on the line: ArrayList cart = (ArrayList)Session["Cart"];
I have EnableSessionState="true" set in the Page Directive.
I am using MS Visual Web Developer 2005 Express Edition. I am able to
reference this variable in other pages.
Your help is greatly appreciated.
Thank you,
Kevin G.