You haven't told us how the shopping cart has been implemented. It's likely though, that you're not seeing results because the add-to-cart code is being executed after the user control refreshes.
To handle this is going to be a little complicated if you haven't done this before (but once you do it it's easy). Your content page will then explicitly call a method in the Master Page. Your Master Page will then call a method in the cart user control which you need to expose.
So to do this, start by going to your shopping cart ASCX and make that method public (the method that adds an item).
Next, add a public method to the Master Page and in this method, call the above public method (obviously, they need to have the same parameters). This is simple enough
Finally, in your content page, you need to call the Master Page's public method. The code for that is something like this (experiment). Assuming your MasterPage is called MySiteMaster.masterCode:public void AddShoppingCartItem(string itemName, int itemId) { shoppingCart1.AddItem(itemName, itemId); }
Code:MySiteMaster master = this.Master as MySiteMaster; if(master != null) { master.AddShoppingCartItem("Xbox", 23489324); }




Reply With Quote