To dynamically add a row to a table, I would be using the append functionality of jQuery. We can use either the
CLONE method (http://api.jquery.com/clone/)
Create a copy of the set of matched elements.
or APPEND method (http://api.jquery.com/append/)
Insert content, specified by the parameter, to the end of each element in the set of matched elements.
I prefer the append method because we got more control on the generation of the element ids/names. In the clone method, the element ids are also copied & by default the events associated are not copied (Using withDataAndEvents parameter we can change this default behaviour).
The HTML which will be appended to the table body -
All the new rows added to the table would contain unique ids/names. The dynamically added controls have an index appended to them.
In the next post I shall explain the fucntionality of AddClicked() and RemoveRow() funtions. Also I shall explain how the jsonsyntax tag would help us in retrieving multiple control/element data for pre-processing; before its sent to the server.