Datagrid question

Posts   
 
    
msdeveloper avatar
Posts: 2
Joined: 12-Jul-2005
# Posted on: 12-Jul-2005 08:36:39   

Hello everybody,

I've got a question about using llblgen collections and showing these in datagrids. I have a Windows based application which displays persons. So what i do with the llblgen generated project is create a collection of persons and bind it to the grid. So far so good.

Example grid layout: personname personbirthdate persongender

Now a persons has addresses. My customer requested the would like to see in the grid not only the persons but also the address of the person. How can i do this with llblgen? I would to use the collection class and let the grid display the right data from this collection? It seems i can only show data from the main collection persons and not the related addresses.

Example requested grid layout: personname personbirthdate persongender addressstreet addresszipcode addresscity

How should i do this? Can you help me?!

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39933
Joined: 17-Aug-2003
# Posted on: 12-Jul-2005 09:59:41   

Add some 'field mapped onto related field' fields to Person which you map on the address fields. Then when you fetch the person collection, specify a prefetch path to also fetch the related addresses. This then should give you the columns you want. simple_smile

Frans Bouma | Lead developer LLBLGen Pro
Rogelio
User
Posts: 221
Joined: 29-Mar-2005
# Posted on: 12-Jul-2005 10:16:46   

By now, to display data in a grid, I use typedList. This way allow me to retrieve only the columns that I want to show from any related tables.

For example: my customer table has 20 fields and 500 records; but I only want to show 2 fields, then it is better to use a typedlist with only the 2 fields that I want to show.

Posts: 31
Joined: 17-Aug-2005
# Posted on: 22-Aug-2005 20:39:11   

You can bind your typed list with the two selected fields to the datagrid. This will only show the required fields and will reduce traffic to and from the server by not including unnecessary fields in the typed list.