DataBinding Asp.net dropdown

Posts   
 
    
david37ni
User
Posts: 4
Joined: 05-Oct-2015
# Posted on: 05-Oct-2015 13:38:52   

I am trying to come up with a common routine for my dropdowns. I have a table called StandardLookup which I am wanting to use to pass a type say lookup type which is a guid to filter out the results at the min im doing this using the llbgendatasource2 control but as I want to keep this a common function its not right to have datasources floating about.

So how would i turn the same funcitonaliilty in


  <llblgenpro:LLBLGenProDataSource2 ID="llblGender" runat="server" AdapterTypeName="uniteCmsDal.DatabaseSpecific.DataAccessAdapter, uniteCmsDalDBSpecific" DataContainerType="EntityCollection" EntityFactoryTypeName="uniteCmsDal.FactoryClasses.UniteCmsUserLookupEntityFactory, uniteCmsDal">
                </llblgenpro:LLBLGenProDataSource2>
    

into a routine I am quite new to LLblgen but have used it before way back in version 3 so my main question is how do i rertrieve the LookupEntity in code without the need for a datasource so that all results are brought back with a type filter =1

Walaa avatar
Walaa
Support Team
Posts: 14946
Joined: 21-Aug-2005
# Posted on: 05-Oct-2015 18:52:22   

I don't understand the question.

Do you have one dropDown which u need to fill out from a table/entity using a filter, and you want to do this in code rather than using an LLBLGenProDataSource control?

Or

Do you have 2 collection controls, say 2 drop down lists, and you want to filter the second one based on the selection of the first one?

And when you say:

I want to keep this a common function its not right to have datasources floating about.

Apparently this is a web site, are you using the same dropdown list several times at the same webpage, or is it used in multiple pages and you want to retrieve it once?

david37ni
User
Posts: 4
Joined: 05-Oct-2015
# Posted on: 05-Oct-2015 18:59:33   

Sorry yes this is asp.net web application which I am buidling a cms and I want to have a standard function to look up what I would call lookup values which would be like a table,

Code Code Name Type M Male 1-2-3-332-3 Guid F Femlae 1---2-22-22-Guid

I need to look up a entity called StandardLookup through code and apply the filter , I would like to add the combox as well but as long as I can get the data without using llbgendatasource2 thats all i need to no..

Walaa avatar
Walaa
Support Team
Posts: 14946
Joined: 21-Aug-2005
# Posted on: 05-Oct-2015 19:16:42   

At form load, you should fetch the EntityCollection, using the DataAccessAdapter.FetchEntityCollection() providing the required filter. Then you should bind the dropDownList dataSource to the entityCollection.

This basically the concept, if you want help at code, please provide a code snippet of what you have tried, so we can take it from there.

david37ni
User
Posts: 4
Joined: 05-Oct-2015
# Posted on: 05-Oct-2015 19:18:17   

But does that not require you to pass a primary key that function ? or is the empty version a overide??. and what should i set as my function return type to make it comptable with your entitys?.

david37ni
User
Posts: 4
Joined: 05-Oct-2015
# Posted on: 05-Oct-2015 19:26:41   

Walaa wrote:

At form load, you should fetch the EntityCollection, using the DataAccessAdapter.FetchEntityCollection() providing the required filter. Then you should bind the dropDownList dataSource to the entityCollection.

This basically the concept, if you want help at code, please provide a code snippet of what you have tried, so we can take it from there.

Can you provide a link to documentation on that I should be able to figure it out form their if the code aint change much since 2011 lol

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 06-Oct-2015 08:28:07   

This is the documentation section you should read to understand how this works.

Also I would recommend to download the Examples package available at Additional Downloads Section. There is a databinding example that you can look at to see this databinding in action.

David Elizondo | LLBLGen Support Team