Getting display text in drop down list(browser enabled infopath f

R

rjayram

Hi,
I have an infopath form where I use a webservice to populate a dropdown
list. I would like to know if there is a way for me to get the display text
of the option chosen by the user. I can get hold of the value, but not the
text. I am using C# code. All I need is this: the user makes a selection from
the dropdown and submits the form. I need to know the display text of the
option selected. The infopath form is browser enabled.

Kindly suggest a solution.

With Best Regards,
Jayram.
 
S

S.Y.M. Wong-A-Ton

Use an XPath expression that contains a filter on the value that was selected
from the drop-down list box and use this to retrieve the corresponding text
by doing a lookup in the secondary data source that the drop-down is bound
to. So:
1. Retrieve the secondary data source that the drop-down is bound to in code.
2. Use SelectSingleNode and an XPath expression to find the one record that
contains the selected value; use an XPath filter for this.
3. Modify the XPath expression to include the node that corresponds to the
text of the selected value, and retrieve its value.

I know it's cryptic, so if you still do not understand how to do it, let me
know and I'll schedule publishing a walkthrough on my website this coming
weekend.
 
R

rjayram

Hi Wong,

Thank you for this excellent and informative(atleast to me and
hopefully to others as well) reply. I was able to use your pointers and get
what I wanted. Thank you very much. But I will still request you to go ahead
and post a walk through on your site. I am sure I will get pointers to better
my code.

Thank you,
Jayram.
 
S

S.Y.M. Wong-A-Ton

No worries. And well done! Since you did solve it yourself, I won't give the
walkthrough a high priority, so may eventually write and publish it, but
perhaps not this weekend.
 
M

mzam

Hi Guys,

I need to do the same thing except that I have to do it all in the form, no
code involved.

I actually need to find out the display value of a drop down and use it as
File Name when submitting the form to a document library. So far I get the
value but not the display value. How do I do this without writing any C# code?

Regards,
Mario
 

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