我正在尝试添加控件,但它正在覆盖。
在下图中,如果我单击添加更多签证按钮,我想显示所有这些字段。
代码:
<asp:PlaceHolder ID="PlaceHolder1" runat="server">
<div id="divreg" runat="server">
<table id="tbl" runat="server">
<tr>
<td class="style8"> Visa Number:</td>
<td class="style20"><asp:TextBox ID="txtUser" Width="160px" runat="server"/></td>
<td class="style22"> Country Name:</td>
<td class="style23">
<asp:DropDownList ID="dropCountry" Width="165px" runat="server"> </asp:DropDownList></td>
</tr>
<tr>
<td class="style22"> Type of Visa:</td>
<td class="style23"><asp:DropDownList ID="dropVisa" Width="165px" runat="server"> </asp:DropDownList></td>
<td class="style22"> Type of Entry:</td>
<td class="style23">
<asp:DropDownList ID="dropEntry" Width="165px" runat="server">
</asp:DropDownList> </td>
</tr>
<tr>
<td class="style8"> Expiry Date</td>
<td class="style20">
<BDP:BasicDatePicker ID="BasicDatePicker4" runat="server" onselectionchanged="BasicDatePicker2_SelectionChanged"
AutoPostBack="True" />
</td>
<td class="style22"><asp:Button ID="btnAddVisa" Text="Add More Visa" runat="server" OnClick="btnAddVisa_Click" /> </td>
</tr></table></div>
</asp:PlaceHolder>
代码.cs:
static int i = 0;
protected void btnAddVisa_Click(object sender, EventArgs e)
{
i++;
for (int j = 0; j <= i; j++)
{
PlaceHolder1.Controls.Add(divReg);
PlaceHolder1.Controls.Add(new LiteralControl("<BR>"));
}
}
图片:在这里我点击添加更多签证按钮我想再次显示这些所有字段
有任何想法吗?提前致谢