Filling a CombBox

Posts   
 
    
JamesKn
User
Posts: 3
Joined: 22-Apr-2006
# Posted on: 22-Apr-2006 17:24:28   

Hi,

I am looking for the most efficient way to fill a combo box .

UnwindManufacturerCollection manf = new UnwindManufacturerCollection(); manf.GetMulti(null);

        this.DataSource = manf;
        this.DisplayMember = "ManuFacturerName";
        this.ValueMember = "ManuFacturerId";
        this.SelectedIndex = -1;

I was hoping to only ask the collection pull out of the database the following fields:

ManuFacturerId ManuFacturerName

instead of the whole collection. Can this be done in LLBLGen Pro ?

My ideas were to make a database view in SQL server ? or create stored procedure myself.

But I was hoping there would be way to specify specific fields in the collection class to pull from . Is there a chance I can ? Or should be using Views or something complete different.

;-)

Any help would be cool ;-)

James

BertS
User
Posts: 89
Joined: 28-Jul-2005
# Posted on: 22-Apr-2006 18:26:35   

Hi James,

You should use a TypedList (via LLBLGen Designer) or a DynamicList (from code) to achieve this. See documentation for further details. There's no way to restrict the fields retrieved in a Collection, while it is a 'collection of enitities', and then you should have all fields available. The *List are the (readonly) alternatives. You can also use a view, and mapping that to an Entity or a TypedView, but that's not the way to go in this case (for filling a combobox with a simple query).

success, Bert

sparmar2000 avatar
Posts: 341
Joined: 30-Nov-2003
# Posted on: 22-Apr-2006 18:31:20   

James

I have created Typed List in designer for something like this.

sparmar2000 avatar
Posts: 341
Joined: 30-Nov-2003
# Posted on: 22-Apr-2006 18:34:15   

Bert ...Snap smile Looks like you were looking at it at the same time as me wink

JamesKn
User
Posts: 3
Joined: 22-Apr-2006
# Posted on: 23-Apr-2006 00:29:14   

Thanks for the response ;-)

TypedList (via LLBLGen Designer) or a DynamicList (from code)

So second dumb question wink of day . Which one is quickest ?

Thanks again for the response ;-)

James