本文介绍了在c#中添加另一个表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
嗨
我有一个Training Html表。这个表中有一个文本框和一个添加按钮。当我点击Add Traning(If Requird)按钮然后另一个Html表创建相同的数据。如何在csharp.pls帮我解决这个问题。
HiI have a Training Html table.Some textbox and one add button in this table . When i click Add Traning(If Requird) button then Another Html table create with same data.How can i solve this problem in csharp.pls help me.
<table class="TableWorkArea" border="1px" cellpadding="3" style="border-collapse: collapse">
<tr>
<td class="TableHeading" colspan="4">
SECTION G : PROFESSIONAL TRAINING</td>
</tr>
<tr>
<td class="TDLeftLabel" width="18%">
Training On
</td>
<td class="TDRightInput" width="32%">
<asp:TextBox runat="server" ID="txtTrainingOn"
CssClass="TextBoxFixed" TabIndex="14" Width="196px"></asp:TextBox>
</td>
</tr>
<tr>
<td class="TDLeftLabel" width="18%">
Training Duration
</td>
<td class="TDRightInput" width="32%">
<asp:TextBox runat="server" ID="txtTrainingDuration" CssClass="TextBoxFixed" TabIndex="14" Width="196px"></asp:TextBox>
</td>
</tr>
<tr>
<td class="TDLeftLabel" width="18%">
Other Info [If Any]
</td>
<td class="TDRightInput" colspan="3">
<asp:TextBox runat="server" ID="txtTraningOther" CssClass="TextBoxFixed" Width="196px"></asp:TextBox>
</td>
</tr>
<tr>
<td class="TDLeftLabel" colspan="4"><asp:Button ID="btnTraningAdd" runat="server" Text="Add Traning(If Requird)" /></td>
</tr>
</table>
推荐答案
protected void btnTraningAdd_Click(object sender, EventArgs e)
{
HtmlTable ht = new HtmlTable();
HtmlTableRow tr = new HtmlTableRow();
HtmlTableCell tc = new HtmlTableCell();
tc.InnerText = "hello";
ht.Rows.Add(tr);
tr.Cells.Add(tc);
PlaceHolder1.Controls.Add(ht);
}
这篇关于在c#中添加另一个表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!