Hello,
I have a form that starts out with one repeating section with 10 rows by defeault. The user has the option of adding more repeating sections. I would like to remove any blank rows from these sections. If the form has only one repeating section tha I am able to successfully remove the blank rows with the following code
XPathNavigator myNav = MainDataSource.CreateNavigator();
XPathNodeIterator NodeIterator =
myNav.Select("/my:myFFIM_base_table/my:Species_Records/my:SpeciesGroup/my:GROUP_1MM/my:GROUP_1MM_sub", NamespaceManager);
XPathNavigator last = myNav.SelectSingleNode(
"/my:myFFIM_base_table/my:Species_Records/my:SpeciesGroup/my:GROUP_1MM/my:GROUP_1MM_sub[" + NodeIterator.Count.ToString() + "]", NamespaceManager);
while (NodeIterator.MoveNext())
{
myNode = NodeIterator.Current.CreateNavigator();
if (CountOneM == "" && LengthOneM == "" && WeightOneM == "")
{
try {
myNode.DeleteRange(last);}
catch(Exception ex){}
}}
But if more sections are added than the DeleteRange line throws an error because last is null. So I am thinking I need to change the path of last XPathNavigator. Can someone please help me? I would greatly appreciate it.
Thanks!!