protected void btnPlaceOrder_Click(object sender, EventArgs e) { string productids = string.Empty; DataTable dt; if (Session["MyCart"] != null) { dt = (DataTable)Session["MyCart"]; ShoppingCart k = new ShoppingCart() { CustomerName = txtCustomerName.Text, CustomerEmailID = txtCustomerEmailID.Text, CustomerAddres = txtCustomerAddress.Text, CustomerPhoneNo = txtCustomerPhoneNo.Text, TotalProducts = Convert.ToInt32(txtTotalProducts.Text), TotalPrice = Convert.ToInt32(txtTotalPrice.Text), PaymenMethod = rdlPaymentMethod.SelectedItem.Text }; DataTable dtReult = k.SaveCustomerDetails(); for(int i=0; i<dt.Rows.Count;i++) { ShoppingCart SaveProducts = new ShoppingCart() { CustomerID = Convert.ToInt32(dtReult.Rows[0][0]), ProductID = Convert.ToInt32(dt.Rows[i]["ProductID"]), TotalProducts = Convert.ToInt32(dt.Rows[i]["ProductQuantity"]) }; SaveProducts.SaveCustomerProducts(); } Session.Clear(); GetMyCart(); lblTransactionNo.Text = "Your Transaction No: " + dtReult.Rows[0][0]; pnlOrderPlacedSuccesfully.Visible = true; pnlCheckOut.Visible = false; pnlCategories.Visible = false; pnlMyCart.Visible = false; pnlEmptyCart.Visible = false; pnlProducts.Visible = false; SendOrderPlaceAlert(txtCustomerName.Text, txtCustomerEmailID.Text, Convert.ToString(dtReult.Rows[0][0])); txtCustomerAddress.Text = string.Empty; txtCustomerEmailID.Text = string.Empty; txtCustomerName.Text = string.Empty; txtCustomerPhoneNo.Text = string.Empty; txtTotalPrice.Text = "0"; txtTotalProducts.Text = "0"; } }