I have the following repeater:
<asp:Repeater ID="_List" runat="server" DataSource="<%# GetList() %>">
<HeaderTemplate>
<table class="dataList">
<tr>
<th>Name</th>
</tr>
</HeaderTemplate>
<ItemTemplate>
<tbody class="list-item">
<tr>
<td runat="server">
<asp:DropDownList ID="_Name" runat="server" DataSource='<%# GetEmployeeList() %>'
DataTextField="Name" DataValueField="Value" />
</td>
</tr>
</tbody>
</ItemTemplate>
<FooterTemplate>
<tr>
<td colspan="3"></td>
<td>
<a id="_Add">Add</a>
</td>
</tr>
</table>
I would like to add a new row dynamically on the client-side using JQuery when the user clicks "_Add" button.
I am able to use the JQuery clone() method successfully to do this. I have also successfully re-sync the IDs inside the repeater to be sequential after adding new items (such as name="$ctl01$_Name" and id="_Name_0" ...etc)
However, when the user Submit the form, ASP.NET does not recognize the dynamically added items from the client-side using JQuery.
i.e. The list initially has 2 items. I've added 3 more items. Instead of Repeater.Items.Count getting 5 items in total, I only get 2 items when it postback.
Any ideas what am I missing??
Thanks all in advance!