views:

31

answers:

2

I have initialised an instance of a class i have called "Relation" this class also contains a list of "Bills". When i databind this information to a grid, the Relations are showing, tho the Bills ain't. The Relation information is returning in a List and the Bills are inside.

Relation cRelation = new Relation();
List<tRelation> relationList = cRelation.getRelations(); 

a relation has:

relation.Bills <== List<tBills>;

How to make sure that the list inside the list is also getting showed in the Datagrid?

+1  A: 

You can't. Use a Master/Detail approach for this, Here's one approach: How to: Create Master/Detail Lists with the Windows Forms DataGrid Control

Marcel
Thanks for trying to help, but i am using my own types, so i can't bind. I have to fill a new datagrid on my own then.
Younes
A: 

Put a GridView inside an ItemTemplate of your grid.

On RowDataBound of your first grid, get the inner grid for each row and apply databinding from the source list as follows:

Relation relation = (Relation) e.Row.DataItem;
GridView grdInner = (GridView) e.Row.FindControl("grdInner");
grdInner.DataSource = relation.Bills;
grdInner.DataBind();
SiN