Ich möchte eine andere Seite sehenDatenansicht ID in asp.net mit
Response.redirect
verwenden, aber ein customerID zusammen mit ihm unter Berücksichtigung. hier meine Button-Code ist:
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();
}
Response.Redirect("Admin/OrderDetails.aspx?Id={0}");
Was sie tut, ist, dass sie dann am Ende alle die Benutzereingabe wird, möchte ich seine/ihre Bestellung Zusammenfassung für den Benutzer zeigen. Wie Sie sehen können, versuche ich Response.Redirect zu verwenden.
Das Problem ist, ich die aktuelle customerID verwenden möchten, wenn ich die Verwendung
Response.Redirect("Admin/OrderDetails.aspx?Id={0}");
irgendwelche Tricks dazu?
Verwenden Session Variable – techspider
Sie mir eine Probe sir geben kann? bitte und danke –
Warum können Sie Query String nicht hinzufügen? Was ist das Problem? – techspider