-1
我有一個電子商務網站,並在我的訂單現在頁面,我有3個單選按鈕列表,即:現金支付,付款gatewat和銀行存款。我打算做的是當你選擇現金付款時,它會引導你進入一個現金支付頁面,當你去付款網關時,它會引導你到另一個頁面等等。如何在單選按鈕列表上實現if語句?
我知道它的代碼:
if
(rblPaymentMethod.SelectedItem.Value="1")
{
code here:
}
但是擁有這些代碼,我不知道放在哪裏。
protected void btnPlaceOrder_Click(object sender, EventArgs e)
{
string productids = string.Empty;
DataTable dt;
if (Session["MyCart"] != null)
{
dt = (DataTable)Session["MyCart"];
decimal totalPrice, totalProducts;
bool totalPriceConversionResult = decimal.TryParse(txtTotalPrice.Text, out totalPrice), totalProductsConversionResult = decimal.TryParse(txtTotalProducts.Text, out totalProducts);
ShoppingCart k = new ShoppingCart()
{
CustomerName = txtCustomerName.Text,
CustomerEmailID = txtCustomerEmailID.Text,
CustomerAddress = txtCustomerAddress.Text,
CustomerPhoneNo = txtCustomerPhoneNo.Text,
TotalProducts = totalProductsConversionResult ? Convert.ToInt32(totalProducts) : 0,
TotalPrice = totalPriceConversionResult ? Convert.ToInt32(totalPrice) : 0,
ProductList = productids,
PaymentMethod = rblPaymentMethod.SelectedItem.Text
};
DataTable dtResult = k.SaveCustomerDetails();
for (int i = 0; i < dt.Rows.Count; i++) // loop on how many products are added by the user
{
ShoppingCart SaveProducts = new ShoppingCart()
{
CustomerID = Convert.ToInt32(dtResult.Rows[0][0]),
ProductID = Convert.ToInt32(dt.Rows[i]["ProductID"]),
TotalProducts = Convert.ToInt32(dt.Rows[i]["ProductQuantity"]),
};
SaveProducts.SaveCustomerProducts();
}
lblTransactionNo.Text = "Your Transaction Number: " + dtResult.Rows[0][0];
pnlOrderPlaceSuccessfully.Visible = true;
pnlCheckOut.Visible = false;
pnlCategories.Visible = false;
pnlMyCart.Visible = false;
pnlEmptyCart.Visible = false;
pnlProducts.Visible = false;
SendOrderPlacedAlert(txtCustomerName.Text, txtCustomerEmailID.Text, Convert.ToString(dtResult.Rows[0][0]));
}
}
任何想法將不勝感激。謝謝!