Newbie

Posts   
 
    
ebola
User
Posts: 1
Joined: 09-Mar-2006
# Posted on: 09-Mar-2006 12:29:11   

Hey guys,

I am new to the LBLGen product. I have managed to generate code and successfully add code into my application to save values to a lookup table.

I am having trouble figuring out how to populate a lookup table from the generated code into a C# list view. I have a Hottopic entity.

Can you guys provide some sample C# code for me please, to get me moving.

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 09-Mar-2006 14:54:53   

It depends on how you retreive your results, using EntityCollection, TypedList..etc The following are 2 samples (C# 2003 / Windows App./ Adapter Scenario) one using an EntityCollection, the other using a TypedList.


EntityCollection Products = new EntityCollection(new ProductEntityFactory());
DataAccessAdapter DAA = new DataAccessAdapter();
DAA.FetchEntityCollection(Products, null);

MyList.DataSource = Products;
MyList.DataTextField = "Name";
MyList.DataValueField = "Id";
MyList.DataBind();


DataTable dtCountries = new DataTable();
CountriesTypedList Countries = new CountriesTypedList();            
DataAccessAdapter DAA = new DataAccessAdapter();
DAA.FetchTypedList(Countries.GetFieldsInfo(), dtCountries, null);

MyList.DataSource = dtCountries;
MyList.DataTextField = "Name";
MyList.DataValueField = "Id";
MyList.DataBind();