0
votes

i have a shopping cart solution written with Asp.Net . in Cart Web Page, i have a list view for products and each item has a dropdownlist for quantity . i want to update total price of each item when user change quantity . i want to use jquery and onchange event of dropdownlist .

 <asp:ListView ID="repItemList" runat="server" DataKeyNames="ID">

     <LayoutTemplate>

         <asp:PlaceHolder ID="itemPlaceholder" runat="server" />
     </LayoutTemplate>
     <ItemTemplate>
         <div class="margin">
         <table class="tbl">
              <tbody>
                  <tr>
                      <td class="four">
                         <table>
                             <tbody>
                                 <tr>
                                    <td class="fone"><%# Eval("Total")%></td>
                                    <td class="ftwo">
                                        <asp:DropDownList ID="lstCount" runat="server" CssClass="DropDownList" onchange="" >
                                            <asp:ListItem Text="1" Value="1" />
                                            <asp:ListItem Text="2" Value="2" />
                                            <asp:ListItem Text="3" Value="3" />
                                            <asp:ListItem Text="4" Value="4" />
                                            <asp:ListItem Text="5" Value="5" />

                                       </asp:DropDownList>
                                    </td>
                                    <td class="ffour"><%# Eval("Price")%>
                                    </td>
1

1 Answers

0
votes

You can get the drop down value on change like,

$('.ftwo').change(function(){
    var price=$(this).closest('tr').find('.fone').html();
    var quantity =$(this).val();
    $(this).closest('tr').find('.ffour').html(price * quantity);
});

you can refer here