In reference to your earlier questions:
I think that at first, you were not using the correct Changed event -- you'd attached it to a group higher than the one you needed. It seems in your post of 08-12-2008 04:29 PM you are attached to the correct changed event, that for your repeating group "Person".
The event will run every time a row is inserted or deleted. If you only have code you want to have run during one or the other operation, you can wrap it in an "if" statement, like so:
if
(e.Operation.Equals("Insert"))
{
//code goes here
}
When I am in doubt about an event, when it is running, how often, etc. I use a message box to let me know:
if (e.Operation.Equals("Insert"))
{
MessageBox.Show("In if statement");
}
You can also put a breakpoint in your code and watch when you hit it. That can help you see when events are being triggered.
On to your code itself. I looked at it more closely today, and I think this is what you need:
id = main.SelectSingleNode("/my:myFields/my:selector_table/my:gpContactSelector/my:Person[1]/my:AccountId", NamespaceManager).Value;
should be:
id = e.Site.CreateNavigator().SelectSingleNode("my:AccountId", NamespaceManager).Value;
e, the variable for the XmlEventArgs being passed into the Changed event, is aware of its location in the table. To go back up to your job title, instead of this:
e.Site.SelectSingleNode("/my:myFields/my:selector_table[1]/my:job_title", NamespaceManager).SetValue(title);
I think you need this:
e.Site.SelectSingleNode("../../my:job_title", NamespaceManager).SetValue(title);
Although I am less sure -- I always have to try several variations to get the xpath right moving back up. Of course, you can also use e.Site.MoveToParent(); to work your way back up the tree.