0
我正在使用带有asp转发器的表格。我想检索表格数据到C#中的数据表。我怎样才能做到这一点?如何将html表格数据获取到数据表格
设计:
<asp:Repeater runat="server" ID="rptItems">
<HeaderTemplate>
<table id="tblDetItems" border="1" style="font-size: 9pt; border-color: #A9A9A9;
position: relative; overflow-y: auto;" class="display" cellspacing="0">
<thead style="background: #808080; color: White; font-weight: bold; border-color: White;">
<tr>
<th style="width: 10px;">
SlNo.
</th>
<th style="width: 200px;">
Item Code
</th>
<th style="width: 300px;">
Description
</th>
<th style="width: 80px;">
Group
</th>
<th style="width: 100px;">
Standard Rate
</th>
<th style="width: 100px;">
Labour Charge
</th>
<th style="width: 100px;">
Recovery Cost
</th>
<th style="width: 80px;">
Active ID
</th>
</tr>
<tr style="background-color: Silver;">
<th style="width: 10px;">
<input type="text" runat="server" style="width: 60px;" id="txtslno" />
</th>
<th style="width: 200px;">
<input type="text" runat="server" style="width: 200px;" id="txtCode" />
</th>
<th style="width: 300px;">
<input type="text" runat="server" style="width: 300px;" id="txtDesc" />
</th>
<th style="width: 80px;">
<input type="text" runat="server" style="width: 80px;" id="txtGroup" />
</th>
<th style="width: 100px;">
<input type="text" runat="server" style="width: 100px;" id="txtStdRate" />
</th>
<th style="width: 100px;">
<input type="text" runat="server" style="width: 100px;" id="txtLbrCharge" />
</th>
<th style="width: 100px;">
<input type="text" runat="server" style="width: 100px;" id="txtRcvryCost" />
</th>
<th style="width: 80px;">
<select id="cmbUseId" runat="server" style="width: 80px;">
<option value="Y">Yes</option>
<option value="N">No</option>
</select>
</th>
</tr>
</thead>
<tbody>
</HeaderTemplate>
<ItemTemplate>
<tr>
<td style="width: 10px; text-align: right; height: 13px;">
<%# Eval("sl_no")%>
</td>
<td style="width: 200px; height: 13px;">
<input type="text" runat="server" style="width: 190px; text-align: left; height: 13px;" id="txtCode" value='<%# Eval("item_cd")%>' onkeyup="return onkeyup_txtphystkv(this,event);" />
</td>
<td style="width: 300px; height: 13px;">
<%# Eval("item_desc")%>
</td>
<td style="width: 80px; height: 13px;">
<%# Eval("gp_cd")%>
</td>
<td style="width: 100px; text-align: right; height: 13px;">
<input type="text" runat="server" style="width: 100px; text-align: right; height: 13px;" id="txtStdRate" value='<%# Eval("std_rt")%>' onkeyup="return onkeyup_txtphystkv(this,event);" />
</td>
<td style="width: 100px; height: 13px;">
<input type="text" runat="server" style="width: 100px; text-align: right; height: 13px;" id="txtLbrCharge" value='<%# Eval("labour_charge")%>' onkeyup="return onkeyup_txtphystkv(this,event);" />
</td>
<td style="width: 100px; height: 13px;">
<input type="text" runat="server" style="width: 100px; text-align: right; height: 13px;" id="txtRcvryCost" value='<%# Eval("recovery_cost")%>' onkeyup="return onkeyup_txtphystkv(this,event);" />
</td>
<td style="width: 80px; text-align: right; height: 18px;">
<select id="cmbUseId" runat="server" style="width: 80px; height: 18px;">
<option value="Y" selected="selected">Yes</option>
<option value="N">No</option>
</select>
</td>
</tr>
</ItemTemplate>
<FooterTemplate>
</tbody> </table>
</FooterTemplate>
</asp:Repeater>
你可以在按钮点击添加一个'C#'代码来创建一个新的空数据表,然后用你的表数据填充它 – Hemal