ads

Showing posts with label VSTA. Show all posts
Showing posts with label VSTA. Show all posts

Tuesday, July 31, 2012

InfoPath delete first row in repeating table via code

The problem:

When you add a new row into a repeating table using code the first line remains blank




The solution:

            XPathNavigator domNav = MainDataSource.CreateNavigator();
            XPathNavigator itemNav = domNav.SelectSingleNode(
           "path to reapeting table[1]",
           NamespaceManager);

            // Delete the row
            if (itemNav != null)
                itemNav.DeleteSelf();

     

Do you like this post?
Buy me a cup of coffe to show your appreciation!

Retrieving data from a secondary data source via VSTA

:The problem
How to retrieve data from a secondary data source using code


:The solution
                
           
            XPathNavigator secondNav = DataSources["data source name"].CreateNavigator();
            XPathNodeIterator rows = secondNav.Select("repeating table Xpath", NamespaceManager);

            while (rows.MoveNext())
            {

                string field1= rows.Current.SelectSingleNode("field name", NamespaceManager).Value;

              
             
          }