This is a migrated thread and some comments may be shown as answers.

problem with hierarchical grid

1 Answer 83 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Greg
Top achievements
Rank 1
Greg asked on 05 Mar 2009, 04:31 PM
Hi,

I would like to bind Rad WPF grid to hierarchical source, let say it is NorthWind DB(Customers, Orders, Orders Details):

1)  Using Linq it doesn't work at all:

            NorthWindDataContext db = new NorthWindDataContext();

            var query = from customer in db.Customers
                        select customer;

            this.radGridView1.AutoGenerateHierarchyFromDataSet = true;
            this.radGridView1.ItemsSource = query;

It seems that you dont support Linq

2) Here situation is the same, but when remove row: this.radGridView1.AutoGenerateHierarchyFromDataSet = true; only Customers data appears without hierarchy:

            DataSet dataSet = dbHelper.getHierarchicalDataSetUsingSQLConnection();
            this.radGridView1.AutoGenerateHierarchyFromDataSet = true;
            this.radGridView1.ItemsSource = ((DataTable)dataSet.Tables["Customers"]).DefaultView;

Strange is that this code works with few of your competitors. Any thoughts?

Greg

1 Answer, 1 is accepted

Sort by
0
Accepted
Nedyalko Nikolov
Telerik team
answered on 07 Mar 2009, 12:10 PM
Hello Greg,

1. We plan to extend our support for hierarchy data sources. For now auto generate hierarchy is supported only for DataSet object. However you can create hierarchy from different datasource with a few lines of code using "property hierarchy" as a reference you can see our online examples.

2. I'm pasting a piece of code from our examples which demonstrates usage of AutoGenerateHierarchyFromDataSet property:

NWindDataSet dataSet = ExamplesDB.GetDataSet(); 
 
radGridView1.AutoGenerateHierarchyFromDataSet = true
radGridView1.DataMember = dataSet.Tables["Orders"].TableName; 
radGridView1.ItemsSource = dataSet; 

You've just missed the DataMember property of the RadGridView which is the entry point for the hierarchy (Master table), and ItemsSource is the whole dataset object.

Kind regards,
Nedyalko Nikolov
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
GridView
Asked by
Greg
Top achievements
Rank 1
Answers by
Nedyalko Nikolov
Telerik team
Share this question
or