Repeating Table - Delete all rows and add back one Default row - InfoPath Dev
in

InfoPath Dev

Use our Google Custom Search for best site search results.

Repeating Table - Delete all rows and add back one Default row

Last post 06-03-2013 08:27 AM by GregE. 0 replies.
Page 1 of 1 (1 items)
Sort Posts: Previous Next
  • 06-03-2013 08:27 AM

    • GregE
    • Not Ranked
      Male
    • Joined on 06-12-2012
    • Norcross, GA
    • Posts 2

    Repeating Table - Delete all rows and add back one Default row

     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

    }

    Filed under: , ,
Page 1 of 1 (1 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.