How to store value and display name of a selected item in dropdown

S

Siva

How to store value and display name of a selected item in dropdown into
separate variables ????

I have dropdown populated with country name as display name and country id
as value. I want to store the selected items name as well as value in
separate variables upon selection in other variables.

As far as my knowledge, we can go to rules use set a field’s value feature.
But with this I can store only value not the display name.

Pls advice.
 
S

S.Y.M. Wong-A-Ton

Correct, so you can easily retrieve the value of the drop-down. If your
drop-down list box is bound to a data source (XML file, database, Sharepoint
list, node in the main data source) you can use the value from the drop-down
list box to search in the secondary data source of your drop-down list box
and retrieve the value of the element or attribute bound to the display name
of the drop-down list box.

So, set up another rule, select the field (for the display name) in your
secondary data source to return AND use the "Filter Data" button on the
"Select a Field or Group" dialog box to tie the field of the drop-down list
box located in the main data source to a corresponding field in your
secondary data source.

It sounds complex, but is fairly straightforward once you get the hang of
it. Let me know if you need more assistance with this.
 
S

S.Y.M. Wong-A-Ton

Same concept, actually.

Retrieve the value for the drop-down list box from the main data source with
selectSingleNode, then search for the display name in the DOM of your
secondary data source by using the value of the drop-down in a filter in an
XPath expression.

Access the DOM for the secondary data source using

XDocument.DataObjects["<your_sec_data_source>"].DOM

Then use selectSingleNode with your XPath expression and filter to find the
value for the display name.
 
S

Siva

thanks buddy.
clean approach.
wish this will work out.

I am not strong in Xpath and XSL.
Appreciate if you could send me links for mastering the both.

S.Y.M. Wong-A-Ton said:
Same concept, actually.

Retrieve the value for the drop-down list box from the main data source with
selectSingleNode, then search for the display name in the DOM of your
secondary data source by using the value of the drop-down in a filter in an
XPath expression.

Access the DOM for the secondary data source using

XDocument.DataObjects["<your_sec_data_source>"].DOM

Then use selectSingleNode with your XPath expression and filter to find the
value for the display name.
---
S.Y.M. Wong-A-Ton


Siva said:
Hi Wong,

Sounds ok. Any other smart way to do with scripting ????
 
S

S.Y.M. Wong-A-Ton

No need to use XSL for this. You can find info on XPath here:
http://www.w3.org/TR/xpath

Unfortunately, I do not have any samples of this on my website. If you get
stuck, just pitch out another question and someone should be able to help you
out.
---
S.Y.M. Wong-A-Ton


Siva said:
thanks buddy.
clean approach.
wish this will work out.

I am not strong in Xpath and XSL.
Appreciate if you could send me links for mastering the both.

S.Y.M. Wong-A-Ton said:
Same concept, actually.

Retrieve the value for the drop-down list box from the main data source with
selectSingleNode, then search for the display name in the DOM of your
secondary data source by using the value of the drop-down in a filter in an
XPath expression.

Access the DOM for the secondary data source using

XDocument.DataObjects["<your_sec_data_source>"].DOM

Then use selectSingleNode with your XPath expression and filter to find the
value for the display name.
---
S.Y.M. Wong-A-Ton


Siva said:
Hi Wong,

Sounds ok. Any other smart way to do with scripting ????

:

Correct, so you can easily retrieve the value of the drop-down. If your
drop-down list box is bound to a data source (XML file, database, Sharepoint
list, node in the main data source) you can use the value from the drop-down
list box to search in the secondary data source of your drop-down list box
and retrieve the value of the element or attribute bound to the display name
of the drop-down list box.

So, set up another rule, select the field (for the display name) in your
secondary data source to return AND use the "Filter Data" button on the
"Select a Field or Group" dialog box to tie the field of the drop-down list
box located in the main data source to a corresponding field in your
secondary data source.

It sounds complex, but is fairly straightforward once you get the hang of
it. Let me know if you need more assistance with this.
---
S.Y.M. Wong-A-Ton


:

How to store value and display name of a selected item in dropdown into
separate variables ????

I have dropdown populated with country name as display name and country id
as value. I want to store the selected items name as well as value in
separate variables upon selection in other variables.

As far as my knowledge, we can go to rules use set a field’s value feature.
But with this I can store only value not the display name.

Pls advice.
 

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