Using Different table field for a datagrid

Posts   
 
    
Bedouin
User
Posts: 15
Joined: 14-Jun-2005
# Posted on: 14-Jun-2005 13:47:17   

Hi, I bind the data using CollectionClasses for datagrid. Table1 id(PK) name surname

Table2 T_id(PK) Productname customerId

for one of the page, i use the collection class of table 2. customerid field table1's primary key.how can i get the name in table1 by using customerid in table2. And than i want to see it datagrid. how can do that bye using self ser.

thank you

jeffreygg
User
Posts: 805
Joined: 26-Oct-2003
# Posted on: 14-Jun-2005 22:17:34   

Bedouin wrote:

Hi, I bind the data using CollectionClasses for datagrid. Table1 id(PK) name surname

Table2 T_id(PK) Productname customerId

for one of the page, i use the collection class of table 2. customerid field table1's primary key.how can i get the name in table1 by using customerid in table2. And than i want to see it datagrid. how can do that bye using self ser.

thank you

If I understand you correctly, you want to be able to include the "Name" column from "Table1" in a grid of data from "Table2". Probably the easiest way to do this is to create a new field in the "Table2" entity based on the related field in "Table1" from within the Designer.

Instructions on how to do this can be found in "Using the Designer->Adding and editing entities->Fields mapped on related fields sub tab" in the documentation.

Hope that helps.

Jeff...

Bedouin
User
Posts: 15
Joined: 14-Jun-2005
# Posted on: 15-Jun-2005 07:30:28   

thank you for your idea jeff, for example, i have a table1 collection class and i also have table2 collection class.when i bind the data for datagrid firstly, i use collection class of table2 than, i make relation with table2 than some values return from that comprasion(id(table1)-costumerid(table2)). than can i add these collection class values.is there any template for adding collection class.is there any standart for collection class, i must have to use only one collection class for filling datagrid

Beside that, i don't want to add new field.Because, when i used sql command for binding data for datagrid it works, now i want to do the same work by using llblgen .can i do?

thank you

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39933
Joined: 17-Aug-2003
# Posted on: 15-Jun-2005 11:17:09   

Bedouin, if you want the customername in the grid when you bind table2 collection to the grid, you have to map a field on a related field in table2's entity as Jeff explained. This then at runtime makes 'table1.customername' part of the columns of the grid when you bind the table2 collection, as every table2 object in the table2 collection then has an extra field, customername. This is necessary because 'customername' is part of another entity, not part of table2.

If you just want to display a list, (readonly) you can also use a typedlist: add Table1 and Table2 to the typed list, and select the fields you want, for example the table2 fields and also table1.customername. Then fill that typedlist and bind it to the grid.

Frans Bouma | Lead developer LLBLGen Pro