Skip to content

Instantly share code, notes, and snippets.

@weipah
Created September 6, 2012 11:43
Show Gist options
  • Save weipah/3655286 to your computer and use it in GitHub Desktop.
Save weipah/3655286 to your computer and use it in GitHub Desktop.
Auto-increment repeating table position in InfoPath
// "my:Inhalte" --> Repeating table data
public void Projektinformationen_Changed(object sender, XmlEventArgs e)
{
//e.Operation property is equal to XmlOperation.Insert or XmlOperation.Delete
XPathNavigator nav = MainDataSource.CreateNavigator();
XPathNodeIterator iter = nav.Select("/my:meineFelder/my:Inhalte/my:Position", NamespaceManager);
int i = 1;
while (iter.MoveNext())
{
iter.Current.SetValue(i.ToString());
i++;
}
i--;
nav.SelectSingleNode("/my:meineFelder/my:maxPos", NamespaceManager).SetValue(i.ToString());
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment