DropDown Liste Databinding

Hello,

I have 2 dropdown List , the first one contains a list of categories and the secon one contains subCategories.

How can I choose an item from the First List and then display only subcategories in the second one .

I have my tables in WFGEN Database and I created two global Lists.

Best Regads,
Sara .

Hi @sara,

Let’s say List 1 contains

Value
A
B
C

And List 2 contains:

Value Text
A 1
A 2
A 3
B 1
B 2
C 1

With the below setup of the dropdownlists:

If DroprownListBox1 = A --> DropdownListbox2 will contain 1,2 and 3
If DroprownListBox1 = B --> DropdownListbox2 will contain 1 and 2
If DroprownListBox1 = C --> DropdownListbox2 will contain 1

Hope this helps.

Eddy.

Hello,

Thanks for the reply Eddy.
Should I add an sql join to the the select request in the second dropdownlist?

Best Regards,
Sara

Hi @sara,

If your global lists are structured similarly to the example I provided, there is no need to perform a join.

If your databind requires complex queries. I recommend doing the databind in code behind.

You can retrieve the global list values in code like this:

WorkflowGen.My.Integration.GlobalLists gl = new WorkflowGen.My.Integration.GlobalLists();
System.Data.DataTable GLOBAL_LIST_DATA;
GLOBAL_LIST_DATA = gl.fetchList("GLOBAL_LIST_NAME", "Column1,Column2", "en-US", true);
foreach (System.Data.DataRow row in GLOBAL_LIST_DATA.Rows){
    ...
}

Eddy.

Hi,
The problem that I have is that when I select the first Value in the first dropdown List I get the correct result but when I change the value I get the first result + the correct result . It seems Like the second Dropdwonlist is not cleared after choosing an item in the first one .

Hi @sara,

You can uncheck the option Append data bound items to avoid this behaviour.

Regards,
Eddy.

Hello,

Thanks Eddy.

Best Regards,

1 Like