I have a browser form where a repeating table is programmatically populated with many rows. I use the first row for the user input that a clicked event uses to create the rows. I need the functionality to reset this repeating table so the user can start over again. Because of the user experience I cannot use the 'Allow user to add a row' functionality' I tried using xmlWriter but I would need to go through every columns (there are more than 40 columns in this repeating table) to set a new default row ... yuck! I didn't want to do that.
Here is my current C# code:
public void NewResetHiddenUntilSubmitted_Clicked(object sender, ClickedEventArgs e)
{
XPathNavigator root = MainDataSource.CreateNavigator();
// Count the amount of Rents nodes
XPathNodeIterator iter = root.Select(
"/my:RepeatingTable",
NamespaceManager);
int rentsNodesCount = iter.Count;
// Retrieve the first Rents node Starting at the first row
XPathNavigator firstRentsNodeNav =
root.SelectSingleNode("/my:RepeatingTable[1]",
NamespaceManager);
// Retrieve the last Rents node
XPathNavigator lastRentsNodeNav =
root.SelectSingleNode("/my:RepeatingTable[" +
rentsNodesCount.ToString() + "]",
NamespaceManager);
// Delete the range of nodes from the first to the last nodes
firstRentsNodeNav.DeleteRange(lastRentsNodeNav);
//This is where I need to add back one default row
}