Ich habe eine Shopping-Seiten, aber habe Probleme mit der Menge, ich weiß nicht, wie Sie den Wert der Textbox auswählen, das ist mein Code.Warenkorb asp.net C#
<table class="table table-condensed">
\t \t \t \t \t <thead>
\t \t \t \t \t \t <tr class="cart_menu">
\t \t \t \t \t \t \t <td class="image">Product</td>
<td><div class="col-md-1"></div> </td>
\t \t \t \t \t \t \t <td class="description"></td>
\t \t \t \t \t \t \t <td class="price">Price</td>
\t \t \t \t \t \t \t <td class="quantity">Quantity</td>
\t \t \t \t \t \t \t <td class="total">Total</td>
\t \t \t \t \t \t \t <td><div class="col-md-1"></div></td>
\t \t \t \t \t \t </tr>
\t \t \t \t \t </thead>
\t \t \t \t \t <tbody>
<!-- begin Cart -->
<% for(int j=0;j<NoItems;j++)
{
Label8.Text = j.ToString();
view();%>
\t \t \t \t \t \t <tr>
<td style="display:block">
<asp:Label ID="Label8" runat="server"></asp:Label></td>
\t \t \t \t \t \t \t <td class="cart_product">
\t \t \t \t \t \t \t \t <a href="#"><img src="/WebVenta/img/enrollable2.jpg" alt="" width="110"></a>
\t \t \t \t \t \t \t </td>
<td><div class="col-md-1"></div></td>
\t \t \t \t \t \t \t <td class="cart_description">
\t \t \t \t \t \t \t \t <h4><a href="/WebVenta/Page/Producto.aspx">Persiana Enrollable</a></h4>
\t \t \t \t \t \t \t \t <p><asp:Label ID="Label1" runat="server" Text=''></asp:Label></p>
\t \t \t \t \t \t \t </td>
\t \t \t \t \t \t \t <td class="cart_price">
\t \t \t \t \t \t \t \t <p><asp:Label ID="Label2" runat="server" Text=""></asp:Label></p>
\t \t \t \t \t \t \t </td>
\t \t \t \t \t \t \t <td class="cart_quantity">
\t \t \t \t \t \t \t \t <div class="cart_quantity_button"> \t \t \t \t \t \t
<asp:TextBox ID="Cantidad" class="cart_quantity_input" runat="server" Width="50px"></asp:TextBox> \t \t \t \t
\t \t \t \t \t \t \t \t </div>
\t \t \t \t \t \t \t </td>
\t \t \t \t \t \t \t <td class="cart_total">
\t \t \t \t \t \t \t \t <p class="cart_total_price"><asp:Label ID="Label3" runat="server" Text="Label" autocomplete="off" size="2"></asp:Label></p>
\t \t \t \t \t \t \t </td>
\t \t \t \t \t \t \t <td class="cart_delete">
\t \t \t \t \t \t \t \t <a class="cart_quantity_delete" onclick="Borrar()" runat="server"><i class="fa fa-times"></i></a>
\t \t \t \t \t \t \t </td>
\t \t \t \t \t \t </tr>
<% i++;
} %>
<!-- end -->
\t \t \t \t \t </tbody>
\t \t \t \t </table>
now in the behind code have this
public string[,] Carrito = new string[20, 13];
NoItems = Convert.ToInt32(Session["NoItems"]);//its the number of differents items
Carrito = (String[,])Session["Cart"];//its a array with all products
public void view()
{
Label1.Text = (String)Carrito[i, 1] + "/" + (String)Carrito[i, 3] + "/" + (String)Carrito[i, 4] + "/" + (String)Carrito[i, 5] + "/" + (String)Carrito[i, 6] + "/" +
(String)Carrito[i, 7] + "/" + (String)Carrito[i, 8] + "/" + (String)Carrito[i, 9] + "/" + (String)Carrito[i, 10];
Label2.Text = "$" + (String)Carrito[i, 2];
Label3.Text = "$" + (String)Carrito[i, 2];
Cantidad.Text = (String)Carrito[i, 13];
}
public void comprar(object sender, EventArgs e)
{
for (int a = 0; a < NoItems; a++)
{
}
}
jetzt seine mein Problem, wie man die Menge des Produkts zu speichern,
jetzt nicht, dass ich eine Datenbank verwenden, alle Informationen, seine in Sessions, die Datenbank ist in Fortschritt.
irgendwelche Ideen? Entschuldigung, mein Englisch.