Copy / Clone - InfoPath Dev
in

InfoPath Dev

Copy / Clone

Last post 09-21-2011 12:04 AM by Patrick Halstead. 2 replies.
Page 1 of 1 (3 items)
Sort Posts: Previous Next
  • 09-19-2011 12:48 PM

    Copy / Clone

    I am trying to copy/clone the current node of a repeating table. I have been all over this site and cant seem to find specifics. When I add this

     [sourcecode]

    XPathNodeIterator listItemNav = this.MainDataSource.CreateNavigator().Select("/my:myFields/my:PSS/my:Product", this.NamespaceManager);

    for (int i = 0; i < listItemNav.Count; i++, listItemNav.MoveNext()) ;

     listItemNav.Current.Clone().InsertAfter(listItemNav.Current);

    [/sourcecode]

    it only copies the last node, no matter where the button is within the node. How can I copy current node and insert on new row?

    Kind regards,
    Larry
    Filed under: ,
  • 09-20-2011 10:32 AM In reply to

    after pulling out my last few hairs i stumbled across the solution. It was much easier than I thought and I was over thinking it. I had a delete control to delete the current record, or row. This deleted the current row the button pressed was in.

    [sourcecode]

    public void DeleteItem_Clicked(object sender, ClickedEventArgs e)
            {
                XPathNavigator nodeToDelete = e.Source;
                nodeToDelete.DeleteSelf();
            }

    [/sourcecode]

    the more I looked at this the more AI new this was my answer. So i married this to my original code and bam! success.

    [sourcecode]

     public void CopyMe_Clicked(object sender, ClickedEventArgs e)
            {
              
                XPathNavigator nodeToClone = e.Source;
                nodeToClone.Clone().InsertAfter(e.Source);

            }

    [/sourcecode]

    Kind regards,
    Larry
  • 09-21-2011 12:04 AM In reply to

    Hi JaxKookie and thanks for the dual post!

    I definitely know the feeling of a hairless odyssey. Thanks for the high gain. No need for low gain here. :)

    Patrick Halstead
    Project Manager at Qdabra
Page 1 of 1 (3 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.