【发布时间】:2014-11-19 01:35:20
【问题描述】:
我有一个在服务器级别运行的 html 表。但是,我无法访问正在填充的数据。
我正在使用 javascript 填充表格,但我需要使用 vb.net 访问数据。
我正在使用 jquery 通过.html 方法将信息获取到页面。
这是我的 javascript,
function ShowProj(strId, qno,ar) {
$('#hiddenQno').val(qno);
$('#qnoLbl').val(qno);
var output = '';
output = "<tr><th>Product</th>";
output += "<th>Bond</th>";
output += "<th>Cut</th>";
output += "<th>Pack</th>";
output += "<th>Delivery date</th></tr>";
for (i = 0; i < ar.length; i++) {
output += "<tr>";
output += "<td style='width: 40%;'>" + ar[i][0] + "</td>";
output += "<td style='width: 10%; text-align: center;'><input type='checkbox' " + (ar[i][1] == 1 ? 'checked' : '') + " /></td>";
output += "<td style='width: 10%; text-align: center;'><input type='checkbox' " + (ar[i][2] == 1 ? 'checked' : '') + " /></td>";
output += "<td style='width: 10%; text-align: center;'><input type='checkbox' " + (ar[i][3] == 1 ? 'checked' : '') + " /></td>";
output += "<td style='width: 30%;'><input type='text' value='" + ar[i][4] + "'/><input type='hidden' value='" + ar[i][5] + "' /></td>";
output += "</tr>"
}
$('#projGrid').html(output);
}
我使用 `ArrayList 从 vb.net 传递信息。
这是我的html,
<div class="modalPopup" id="projPopup" style="width: 40%;">
<table style="width:100%;">
<tr>
<td colspan="2">
<table id="projGrid" runat="server" style="width: 100%;border: 1px solid black; font-size: 16;">
</table>
</td>
</tr>
<tr>
<td>
</td>
<td>
</td>
</tr>
<tr>
<td>
<asp:Button ID="projOk" runat="server" Text="Update" /></td>
<td>
<asp:Button ID="projCncl" runat="server" Text="Cancel" />
</td>
</tr>
</table>
</div>
这是我的 vb.net。
For Each row As HtmlTableRow In projGrid.Rows
'Dim chkBond As HtmlInputCheckBox = row.Cells(1).Controls(0)
Dim str As String
str = row.Cells(0).InnerText
Next
【问题讨论】:
-
您有没有机会看到我的回复,我认为您需要采用一些隐藏字段的方法,因为您无法更新视图状态,因此无法在后面的代码中使用它。
-
为什么不使用 Knockout.js 和 WebApi 创建和进行 CRUD 操作?
标签: javascript jquery html asp.net vb.net