There is a fairly simple solution for this. Assuming you have a View Model form that temporarily stores data for what the user enters, you can simply add an additional “empty” ViewModel to the collection that the repeater uses as the data source. When saving, you can simply save all changes to the database that exist in your view model. Possible example:
protected void btnAdd_OnCommand(object sender, EventArgs e)
{
List<Item> items = (List<Item>)this.ItemRepeater.DataSource;
items.Add(new Item() { Id = -1 });
this.ItemRepeater.DataBind();
}
protected void btnSave_OnCommand(object sender, EventArgs e)
{
List<Item> items = (List<Item>)this.ItemRepeater.DataSource;
foreach (Item itm in items)
{
if (itm.Id == -1)
{
}
else
{
}
}
}
The main disclaimer here is that you must re-populate the ItemRepeater data source with view models updated with any changes made by the user (which you would like to save / show).