private void rptProductsList_ItemCommand(object source, RepeaterCommandEventArgs e) { int productID = Convert.ToInt32(((HtmlInputControl)e.Item.FindControl("hdnProductID")).Value); switch(e.CommandName) { case "btnAddToCart": // if (CheckAttributeSelection(e.Item)) DropDownList tmpDropDown = ((DropDownList)e.Item.FindControl("ddlAttributes")); if (tmpDropDown.SelectedValue != "0") { BPShoppingCartDetails bp = new BPShoppingCartDetails(); CartID = bp.FindShoppingCart(CustomerID,CartID); if (!IsNumeric(((TextBox)e.Item.FindControl("txtQuantity")).Text)) { ((TextBox)e.Item.FindControl("txtQuantity")).Text = "0"; } int quantity = Convert.ToInt32(((TextBox)e.Item.FindControl("txtQuantity")).Text); int selectedAttributeID = 0; if (tmpDropDown.SelectedValue != "") { selectedAttributeID = Convert.ToInt32(tmpDropDown.SelectedValue); } // if ((((Label)e.Item.FindControl("lblProductAttributeID")).Text) != "") // selectedAttributeID = Convert.ToInt32(((Label)e.Item.FindControl("lblProductAttributeID")).Text); bp.AddItemToCart(CustomerID,CartID,productID,selectedAttributeID,quantity); QuickCart1.Refresh(CustomerID,CartID); tmpDropDown.SelectedIndex = -1; ((Label)e.Item.FindControl("lblErrMsg")).Text = ""; ((TextBox)e.Item.FindControl("txtQuantity")).Text = "1"; // ((Label)e.Item.FindControl("lblProductAttributeName")).Text = ""; // ((Label)e.Item.FindControl("lblProductAttributeID")).Text = ""; // dgAttributes.SelectedIndex = -1; } else { ((Label)e.Item.FindControl("lblErrMsg")).Text = "Please choose a color first."; } break; case "ChooseAttribute": LoadAttributes(productID); CurrentProductRepeaterIndex = e.Item.ItemIndex; RegisterStartupScript("LoadPopup","<script>window.onLoad = openPopup('attributes_bg');</script>"); break; } }