I modified the sample you have given as per my requirement.
In Data.cs, instead of address property, i create addresses property instead of address property as shown below (and accordingly modify the constructor).
private DataCollection addresses;
public DataCollection Addresses
{
get { return addresses; }
set { addresses = value; }
}
In form.cs,
i do the following change
Address add1 = new Address("5th Avenue", "Chennai");
Address add2 = new Address("6th Avenue", "Mumbai");
DataCollection addresses = new DataCollection();
dataSource.Add(new Data("1", "Condiments", "Sweets", "",addresses));
It doesnt binds the data by drilling down addresses collection as you suggeted.
Thanks
>Thanks for the reply.
But my problem is somewhat different. Let me try to rephrase it. Lets say a collection has 5 items so when i bind it to grid, in a normal scenario, i would see five rows and a cloumn. I want to see 5 columns in a row. To further extend it to your example, if you have a dictionary object Address (having Address objects from your example, the number of which is not known at design time), how would that be handled. so for example, if a customer in your example has 5 address (which is decided at run time), how will that be handled
>Hi Dinesh,
When you bind a business object which itself contains some custom objects (like "Address" object ), the grouping grid will go down into the hierarchy and will create one column descriptor for each and every column in this hierarchy. Suppose if your "Address" class contains two members, the grouping grid will display these two columns and their record values where as the datagrid or databound grid will not show the record values
Here is a sample.
BindingArrayList_.zipBest Regards,
Haneef