Code snippet to add a blank row as last row in a InfoPath repeating table.
//Get the repeating table node
XPathNavigator Group = MainDataSource.CreateNavigator().SelectSingleNode("/my:myFields/my:AnalysisGroup/my:AnalysisTable", NamespaceManager);
//Get the Iterator object to iterate the node to last row
XPathNodeIterator rows = Group.Select("/my:myFields/my:AnalysisGroup/my:AnalysisTable", NamespaceManager);
//Loop to move the cursor to last row
for (int counter = 0; counter < rows.Count; counter++, rows.MoveNext()) ;
//clone the last row and insert it after that
rows.Current.Clone();
rows.Current.InsertAfter(rows.Current);
//move the cursor to the last row
rows.MoveNext();
//Set all the fields in the row to blank
rows.Current.SelectSingleNode("my:ItemDesc", NamespaceManager).SetValue("");
rows.Current.SelectSingleNode("my:Tax", NamespaceManager).SetValue("");
No comments:
Post a Comment