How to fill a dropdown list

Posts   
 
    
JayBee
User
Posts: 282
Joined: 28-Dec-2006
# Posted on: 05-Jan-2008 01:01:59   

I was wondering how to fill a dropdownlist. I have an entity with one single field I would like to use as a filter. Before using LLBLGen I would probably have created a stored procedure with a SELECT DISTINCT fieldToBeUSed FROM EntityToBeFiltered and used the result as data to fill the dropdownlist.

What is the prefered way to do this in LLBLGen?

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 05-Jan-2008 04:25:00   

If you have an entity with a non-PK single field, I would recommend go on DynamicList. Then you can attach the resulset in you DropDownList datasource. Please check the manual to see how you can use DynamicLists wink

David Elizondo | LLBLGen Support Team
JayBee
User
Posts: 282
Joined: 28-Dec-2006
# Posted on: 05-Jan-2008 17:19:40   

Is there no possibility to use the LLBLGenProDataSource? Thats a pitty.

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 06-Jan-2008 01:36:30   

If you want to use LLBLGenProDataSource(2) at design-time you can:

  1. Design your TypedList at LLBLGenPro Designer.
  2. Attach the TypedList to a LLBLGenProDataSource(2) at design-time and set yourLLBLGenProDataSource.LivePersistence = false;
  3. Create a event handler for yourLLBLGenProDataSource.PerformWork
  4. At that event handler fetch the typedList with the overloads that lets you set the allowDuplicates = false.
David Elizondo | LLBLGen Support Team