I already banged my head on the wall for the whole day. I am working on Apress "Getting ASP.NET E-Commerce in C #", in case someone is familiar with the project. In Chapter 10, we work with the PayPal AddToCart and GoToCart features. This is an event that does not fire:
//Why is this not working? protected void AddToCartButton_Click1(object sender, EventArgs e) { string productID = Request.QueryString["ProductID"]; ProductDetails pd = CatalogAccess.GetProductDetails(productId); string options = ""; foreach (Control cnt in attrPlaceHolder.Controls) { if (cnt is Label) { Label attrLabel = (Label)cnt; options += attrLabel.Text; } if (cnt is DropDownList) { DropDownList attrDropDown = (DropDownList)cnt; options += attrDropDown.Items[attrDropDown.SelectedIndex] + "; "; } string productUrl = Link.ToProduct(pd.ProductID.ToString()); string destination = Link.ToPayPalAddItem(productUrl, pd.Name, pd.Price, options); Response.Redirect(destination); }
Here is the LinkButton code:
<p> <asp:LinkButton ID="AddToCartButton" runat="server" CausesValidation="False" OnClick="AddToCartButton_Click1">Add to Shopping Cart</asp:LinkButton> </p>
I tried to set a breakpoint, but the event was never reached. LinkButton also raises a postback, but never fires an OnClick event.
Any help would be greatly appreciated!
Here url: http://www.northarktest.net/edwards/balloonshop
It seems that the click event is fired on the server, but with local debugging.
Bazinga
source share