Good morning,
This code was jumbled together in HTML(but it worked). I'm bringing
it into VS 1.1.
I noticed that you can't get away with certain things in VS.
Could someone explain why:
ATC1.UserControls.Shoppingcart does not contain a definition
of "Add", "Remove" , "Items"
The intellisence recognizes it, and when doing a "go to definition"
it jumps to the appropriate function?
the Items issue:
private void Page_PreRender(Object sender , EventArgs e)
{
if ( objShoppingCart.Items.Count == 0 )
{
btnCheckOut.Visible = false;
}
else
{
btnCheckOut.Visible = true;
btnCheckOut.NavigateUrl = string.Format("~/CheckOut.aspx?cat=
{0}", intCategory );
}
}
public DataView Items
{
get { return _dstCart.Tables["Cart"].DefaultView ;}
}
public void Remove( int ItemIndex )
{
_dstCart.Tables["Cart"].Rows[ItemIndex].Delete();
UpdateCartDB();
}
public void Add( int ProductID, string ProductName, Decimal
UnitPrice )
{
bool blnMatch = false;
DataRow drowItem;
foreach (DataRow row in _dstCart.Tables["Cart"].Rows)
{
if ( (int)row["ProductID"] == ProductID )
{
row["Quantity"] = (int)row["Quantity"]+1;
blnMatch = true;
}
}
if (! blnMatch ) {
drowItem = _dstCart.Tables["Cart"].NewRow();
drowItem["UserID"] = _guidUserID;
drowItem["ProductID"] = ProductID;
drowItem["ProductName"] = ProductName ;
drowItem["UnitPrice"] = UnitPrice;
drowItem["Quantity"] = 1;
_dstCart.Tables["Cart"].Rows.Add( drowItem );
}
UpdateCartDB();
}
Thanking you in advance,
------------------------ Yahoo! Groups Sponsor --------------------~-->
Fair play? Video games influencing politics. Click and talk back!
http://us.click.yahoo.com/T8sf5C/tzNLAA/TtwFAA/saFolB/TM
--------------------------------------------------------------------~->
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/AspNetAnyQuestionIsOk/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/