Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I had got in similar situation few days back I am posting my solution.</p> <p>I am supposing that ur table look like this.</p> <pre><code>&lt;table id="partTable"&gt; &lt;tr&gt; &lt;td class="cell"&gt;Nitin&lt;/td&gt; &lt;td class="desc"&gt;Varpe&lt;/td&gt; &lt;td class="desc"&gt;8881&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td class="cell"&gt;Parag&lt;/td&gt; &lt;td class="desc"&gt;Lombar&lt;/td&gt; &lt;td class="desc"&gt;4999&lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;div&gt; &lt;input type="button" id="sendRequest" value="send" /&gt; &lt;/div&gt; &lt;script type="text/javascript"&gt; $('#sendRequest').click(function (e) { PostTable(); }); // Read a row function GetRow(rowNum) { var tableRow = $('#partTable tr').eq(rowNum); var row = {}; row.FirstName = tableRow.find('td:eq(0)').text(); row.LastName = tableRow.find('td:eq(1)').text(); row.RollNumber = tableRow.find('td:eq(2)').text(); return row; } // Read all rows function GetAllRows() { var dataRows = []; $('#partTable tr').each(function (index, value) { var currentRow = GetRow(index); dataRows.push(currentRow); }); return dataRows; } // POST rows to server function PostTable() { //var crossId = getParameterByName('id'); var jsonRequest = { rows: GetAllRows()}; $.ajax({ type: 'POST', url: "@(Url.Action("Action", "Controller"))", data: JSON.stringify(jsonRequest), contentType: 'application/json; charset=utf-8', dataType: 'json', async: false, success: function (data) { //ur logic after success return true; }, error:function (ts){ alert(ts.responseText); return false; } }); } &lt;/script&gt; </code></pre> <p>Here is the class.</p> <pre><code>public class Row { public string FirstName { get; set; } public string LastName { get; set; } public string RollNumber { get; set; } } </code></pre> <p>Action to call</p> <pre><code>public ActionResult GetRows(List&lt;Row&gt; rows) { //your logic return Json(new { list = object }); } </code></pre> <p>Hope this helps!</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload