Retrieve Display Name

S

Sjoukje Zaal

Hi,

I'm trying to retrieve the display name of an infopath field by code.

I've found the following code on the internet but I get an error when I use
it.

XPathNavigator selNav = MainDataSource.CreateNavigator();
string name =
domNav.SelectSingleNode("/my:plannenTraining/my:cursistenGroep/my:CursistenGroepCursistenOverzicht[@Id
= '" + value + "']/@title", NamespaceManager).Value;

@title is the paramater of the Display Name

Any suggestions anyone?

Regards,
Sjoukje
 
G

Greg Collins

This code is written to the InfoPath 2007 OM. Are you using that, or are you
using the InfoPath 2003 OM?

One issue is that they change variable names midstream from selNav to
domNav:

XPathNavigator domNav = MainDataSource.CreateNavigator();
string name =
domNav.SelectSingleNode("/my:plannenTraining/my:cursistenGroep/my:CursistenGroepCursistenOverzicht[@Id
= '" + value + "']/@title", NamespaceManager).Value;

Here's a translation to the IP03 OM:

IXMLDOMNode domNav = thisXDocument.DOM;
string name =
domNav.selectSingleNode("/my:plannenTraining/my:cursistenGroep/my:CursistenGroepCursistenOverzicht[@Id
= '" + value + "']/@title", NamespaceManager).text;
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top