Click here to Skip to main content
15,884,085 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

Am working shopping cart project in MVC razor with knockoutJS.

My scenario is an grid with dropdown. Each products will have different quantity in a dropdown cntrl.

Example:

Product : hammam soap
Quantity (dropdown cntrl) : 1,2,3,4

Product : rice
Quantity: 200,400,500,1000

My problem is for all product shows same quantity . It takes last product quantity for all products. I need solution for this ASAP.

Here my Code :

XML
<table style="width:100%;">
                        <thead>
                            <tr style="width:80%; left:10%; background-color:#dedede; color:#5c8f0a; ">
                                <th style="width:20%">
                                    <b> ProductName</b>
                                </th>
                                <th style="width:20%">
                                    <b> PurchaseQty</b>
                                </th>
                                <th style="width:20%">
                                    <b> PurchasePrice</b>
                                </th>
                            </tr>
                        </thead>
                        <tbody data-bind="foreach: productmodel.Addtocartlist">
                            <tr>
                                <td data-bind="text: ProductName"></td>
                                <td>

                                    <select id="projectMenu" name="projectMenu" data-bind="value: selectedProject,options:Qty,optionsText:'quantity',event: { change: selectionChanged }"></select>
                </td>
                                <td data-bind="text: Purchaseprice"></td>

                            </tr>
                        </tbody>
                    </table>
Posted
Updated 6-Nov-14 18:53pm
v2
Comments

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900