Hi all. I am trying to do a basic button functionality thing where you are able to move nodes up or down, in a repeating section or table. Now I know there is some VBScript at http://blogs.msdn.com/infopath/archive/2005/02/23/378968.aspx. This should be simple to port over to C# (which I need to do) but there are some nuances I can't figure out. How do I select the current node with the C# version? In VBScript you can just set currentNode = eventObj.source, but in C# the argument variable e is of type XPathNavigator. Can someone please point me in the right direction. I have played around with all the functionality in an XPathNavigator object and cannot get it to return the current node in any way. I might be going about this completely wrong.
Thanks for the help. Below is my code.
public void CTRL27_11_Clicked(object sender, ClickedEventArgs e)
{
XmlNode currentNode, parentNode, prevNode;
currentNode = /* what goes here? */
parentNode = currentNode.ParentNode;
prevNode = currentNode.PreviousSibling;
if (prevNode != null)
{
parentNode.RemoveChild(currentNode);
parentNode.InsertBefore(currentNode, prevNode);
}
}
public void CTRL28_11_Clicked(object sender, ClickedEventArgs e)
{
XmlNode currentNode, parentNode, nextNode;
currentNode = /* what goes here? */
parentNode = currentNode.ParentNode;
nextNode = currentNode.NextSibling;
if (nextNode != null)
{
parentNode.RemoveChild(nextNode);
parentNode.InsertBefore(nextNode, currentNode);
}
}
I just don't see how you are able to move the nodes around in Clicked( ) in C#,
when all you are passed is an XPathNavigator. All of the XPathNavigator
methods are for moving itself to other nodes. What I want to do is
actually move the nodes themselves.
Thanks again.