2016-05-20 4 views
-3

ショッピングページがありますが、数量に問題があります。テキストボックスの値を選択する方法はわかりません。これは私のコードです。 ショッピングカート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++) 
 
    { 
 
     
 
    } 
 
}
は今、私の問題は、今私は、データベースを使用するすべての情報をいけない生成物の量、

を保存する方法をそのセッションでは、データベースがであるその進捗。

すみません、私の英語です。

答えて

0

あなたはまた、CssClassにCantidadためclass属性を変更する必要がありCantidad

int quantity = 0; 
int.TryParse(Cantidad.Text, out quantity); 

からテキストを解析して数量を読むことができます。

関連する問題