I have a table:
<table id="selectedInv">
<thead>
<tr class="alternate">
<th>
Barcode
</th>
<th>
OverAll Count
</th>
<th>
Transfer Count
</th>
</tr>
</thead>
<tbody>
<tr class="1">
<td> 2323 </td><td> 9 </td><td><input type="text" value="3"></td></tr>
<tr class="2">
<td> 2329 </td><td> 5 </td><td><input type="text" value="2"></td></tr>
<tr class="3">
<td> 2329 </td><td> 3 </td><td><input type="text" value="1"></td></tr>
</tbody>
</table>
After button click I want to collect data like
[{1,3},{2,2},{3,1}]
Where in
[{a,b}] a=className of row, b=input text value in this row.
And post this data to action method, what is the best way to do this?
As i see u have two fields to collect data from each row namely Class and Transfer count. i would make a view model for it like
In my view i would write a loop that creates following html
supposing that you are posting the form to index method. it would look like
don’t forget the submit button to post the form. For more information read this article
Following search would also prove good for you