on 01-03-2008 2:35 PM
Hi,
im using dropdownbykey(DYNAMICALLY). So at the run time i wanted to get the selected element. In this i've created context dynamically
the code should as follows
if(selected value=INDIA)
{
do this;
so pls help me with it.
You have to access the value of the context attribute to which you have bound the "selectedKey" property.
Example: Attribute is named "country" and at root level:
String selectedCountry = wdContext.currentContextElement().getCountry();
/* or if attribute was created by code: */
String selectedCountry = (String) wdContext.currentContextElement().getAttributeValue("country");
if ( "INDIA".equals(selectedCountry) )
{
/* INDIA is selected in drop-down list */
}
Armin
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Amit,
I could not understand your requirement but change if condition
like this if the selected value is String
if(selected value.isEqualsIngonreCase(INDIA))
{
// do what you want
}
If you want to access the key of the DropDown dynamically, you can do like this
if(<DropDownInstance>.getSelectedKey().isEqualsIngonreCase(INDIA))
{
//
}
regards,
Siva
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Amit,
If you want to get the attribute value, you can get in two ways.
Using DropDown
1.Get the instance of DropDownByKey in wdDoModifyView()
like IWDDropDownByKey dbkey = (IWDDropDownByKey) view.getElement("ID_DROPDOWN");
2.Set the SelectedKey property
dbkey.getSelectedKey();
or
Using Context attribute
wdContext.current<dropdownnode>Element().get<DropDownAttribute>();
Do null check wherever necessary.
regards,
Siva
User | Count |
---|---|
93 | |
11 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.