cancel
Showing results for 
Search instead for 
Did you mean: 

How to set a default value in my DropDown using the key ?

Former Member
0 Kudos

Hello All,

Can someone advose how I can achieve the above ? I will like to know how to select a default value for the dropdown by key using the key value instead of description.

The reason why I need to do so instead o fusing description is because my application will populate the dropdown using web services based on the language selection. Hence, if I were to set the default value using description, den other languages will not work anymore.

Any help will be greatly appreciated. Thank you !!

from

KWok Wei

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Kwok,

Assuming that:

1. You have a node NodeX, where attribute TargetAttr defined

2. You have a DropDownByKey UI control, its property selectedKey bound to NodeX.TargetAttr attribute

Then:

Place in your code:

wdContext.currentNodeXElement().setTargetAttr("yourKey");

VS

P.S. This topic was raised several times, and forum search works good enough to find an answer

Former Member
0 Kudos

Hello VS,

It works. The solution posted on SDN did not work for me because apparently I made a stupid TYPO error and hence it lead me to come to the conclusion that the way to display a default value based on desciption/key is different. Nonetheless, thank you very much for yor help.

from

Kwok Wei

Answers (0)