简体   繁体   中英

How to get html table values in code behind c#

I have one HTML table. In the table I added a tr during run-time using the javascript code below -

var table = document.getElementById("myTable");
var tab_length= table.rows.length;
var row = table.insertRow(tab_length);
row.id="Row"+tab_length;
var Ord_ID = row.insertCell(0);
var Ord_Name = row.insertCell(1);
var Ord_Qty = row.insertCell(2);
var Ord_Price = row.insertCell(3);
var Ord_Total = row.insertCell(4);
var Del_Button = row.insertCell(5);
var Edit_Button = row.insertCell(6);    
Ord_ID.innerHTML = document.getElementById("Ord_ID").value;
Ord_Name.innerHTML = document.getElementById("Ord_Name").value;
Ord_Qty.innerHTML = document.getElementById("Ord_Qty").value;
Ord_Price.innerHTML = document.getElementById("Ord_Price").value;

But I can not access the tr values in c#. Can anyone please help with this problem?

I would use JQuery to send an Ajax POST request. If you want to do error handling, you can return either a success or error message in JSON format. Have a look at this link for more information:

http://api.jquery.com/jquery.ajax/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM