navigating xPath in field changed event using C# - InfoPath Dev Sign in | Join | Help in Browser Forms InfoPath (Entire Site) InfoPath Dev InfoPath Dev is dedicated to bringing you the information and tools you need to be successful in your Microsoft Office InfoPath development projects. Home Blogs Forums Photos Downloads InfoPath Dev » InfoPath » Browser Forms » navigating xPath in field changed event using C# navigating xPath in field changed event using C# Last post 07-05-2012 10:41 AM by Hilary Stoupa. 1 replies. Page 1 of 1 (2 items) Sort Posts: Oldest to newest Newest to oldest Previous Next 07-05-2012 06:09 AM Paradiddle Joined on 01-28-2010 Posts 40 navigating xPath in field changed event using C# Reply Contact I'm using InfoPath 2007 to create a browser form. In the form I have a Contact Selector. When it changes I want to get the value of the AccountID and set another field and run additional code. The xpath of the Contact Selector node that my changed event is triggered from is:/my:myFields/my:gpAuthor/my:gpContactSelector/my:Person/my:AccountId I'd like to set this field: /my:myFields/my:DebugTo get the current fields value I'm using: String author = e.Site.Value;I've tried the following to set Debugs value but none of them seem to work:1. e.Site.SelectSingleNode("/my:myFields/my:Debug", NamespaceManager).SetValue(author)2. e.Site.MoveToRoot(); e.Site.SelectSingleNode("/my:myFields/my:Debug", NamespaceManager).SetValue(author);3. e.Site.SelectSingleNode("../../my:Debug", NamespaceManager).SetValue(author);4. e.Site.SelectSingleNode("../../../my:Debug", NamespaceManager).SetValue(author);5. e.Site.SelectSingleNode("../../../../my:Debug", NamespaceManager).SetValue(author);6. e.Site.SelectSingleNode(",,/,,/,,/../../my:Debug", NamespaceManager).SetValue(author);How is this supposed to be done?Thanks, Dave Filed under: web form, Infopath, C#, XPathNavigator, infopath2007 07-05-2012 10:41 AM In reply to Hilary Stoupa Joined on 06-20-2008 Posts 13,297 Re: navigating xPath in field changed event using C# Mark as Not AnswerMark as Answer... Reply Contact Since this is a node outside any repeating group, I'd probably just use: this.MainDataSource.CreateNavigator().SelectSingleNode("/my:myFields/my:Debug", NamespaceManager).SetValue(author); Hilary Stoupa Page 1 of 1 (2 items) Copyright © 2003-2019 Qdabra Software. All rights reserved.View our Terms of Use.
I'm using InfoPath 2007 to create a browser form. In the form I have a Contact Selector. When it changes I want to get the value of the AccountID and set another field and run additional code. The xpath of the Contact Selector node that my changed event is triggered from is:
/my:myFields/my:gpAuthor/my:gpContactSelector/my:Person/my:AccountId
I'd like to set this field:
/my:myFields/my:Debug
To get the current fields value I'm using:
String author = e.Site.Value;
I've tried the following to set Debugs value but none of them seem to work:
1. e.Site.SelectSingleNode("/my:myFields/my:Debug", NamespaceManager).SetValue(author)
2. e.Site.MoveToRoot();
e.Site.SelectSingleNode("/my:myFields/my:Debug", NamespaceManager).SetValue(author);
3. e.Site.SelectSingleNode("../../my:Debug", NamespaceManager).SetValue(author);
4. e.Site.SelectSingleNode("../../../my:Debug", NamespaceManager).SetValue(author);
5. e.Site.SelectSingleNode("../../../../my:Debug", NamespaceManager).SetValue(author);
6. e.Site.SelectSingleNode(",,/,,/,,/../../my:Debug", NamespaceManager).SetValue(author);
How is this supposed to be done?
Thanks,
Dave
Since this is a node outside any repeating group, I'd probably just use:
this.MainDataSource.CreateNavigator().SelectSingleNode("/my:myFields/my:Debug", NamespaceManager).SetValue(author);