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

Constructing a Grid with multiple datasets

1 Answer 32 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Riaan Gouws
Top achievements
Rank 1
Riaan Gouws asked on 20 Oct 2010, 10:41 AM
Hi,

I'm dealing with a scenario where I want to construct a grid with multiple datasets. I.e. One grid control with multiple tables within it (each table with a different datasource).

I return the XML data from Sql Server and load the XML into multiple datasets using the DataSet's ReadXml() function.

Each DataSet in turn gets added to a dictionary with a GUID to reference it back when I need to make changes to a specific dataset.

I was looking at using the GridTableView class but I'm not sure if this will fulfill my needs.

For a quick experiment I tried doing the following:

foreach (KeyValuePair<Guid, DataSet> ds in dataSetCollection)
{
GridTableView gtv = new GridTableView(RadGrid1);
gtv.DataSource = ds.Value; //ds.Value is a DataSet object
gtv.DataBind();
RadGrid1.MasterTableView.DetailTables.Add(gtv);
}

The above doesn't seem to do anything, just a blank grid.

What am I missing here or is there any alternative route I can take to achieve the same?

Thanks for your help.

1 Answer, 1 is accepted

Sort by
0
Tsvetina
Telerik team
answered on 25 Oct 2010, 01:05 PM
Hello Riaan,

First of all, you should not be using simple data-binding when creating hierarchy in RadGrid. Instead, you could either use the automatic hierarchy generation feature of RadGrid, demonstrated in this online demo, or bind the grid in the NeedDataSource event handler for the MasterTableView and DetailTableDataBind event handler for the nested GridTableViews. For the second option you can use logic similar to the one demonstrated in this demo or in our help article on that topic.

I hope these resources help you achieve the desired functionality.

Greetings,
Tsvetina
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
Grid
Asked by
Riaan Gouws
Top achievements
Rank 1
Answers by
Tsvetina
Telerik team
Share this question
or