Is it possible to get dynamically added elements in C# after the DOM has loaded. Here is my example below.
The idea is to have rows added, dynamically from user intervention, then the user submits the form and the C# codebehind will iterate through each, new added row.
However, no matter how many rows are added, the C# will only count 1 row.
Here is the HTML / Jquery / C#
HTML
Before new rows are added to table.
<table id="tblRecordedBags" runat="server" class="tblBags">
<tr>
<th>Amount</th><th>Drop Bag Number</th><th>Edit</th><th>Remove</th>
</tr>
</table>
<input type='text' class='txtBagNum' id='txtBagNum'>
jQuery
Used to add new rows.
$('.addBag').on('click', function(){
$(".tblBags").append(
'<tr class="bag"><td class="bag">'
+ $(".total").val() + '</td><td class="bagID">'
+ $(".txtBagNum").val() + '</td>'
+ "</tr>'
});
C# Codebehind
Quick debug write
System.Diagnostics.Debug.Write(tblRecordedBags.Rows.Count);