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

[Solved] Custom Data Source and Hierarchical RadGrid

1 Answer 180 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Nick Gohad
Top achievements
Rank 1
Nick Gohad asked on 01 Dec 2009, 06:40 PM
Hello,
I have 2 Tables in the database Employee and Deprtament. I get these 2 tables from the database using NHibernate.After doing that I get a Department Object of type IList. Inside that object I have Employee collection.
When I try to bind this Department object to one level grid (Non-Hierarchical it works fine, I see all the departments in the grid
Now I am trying to create a Hierarchical grid where Master grid will display all departments and each department can be expanded to see employees.
Here is the thing, I am trying to bind my Deprtment object to a parent grid, Parent Grid has a proprty called DataSourceID When I do

RadGrid1.DataSourceID =

"Department" I get an error saying "The DataSourceID of 'RadGrid1' must be the ID of a control of type IDataSource"
I am not sure how to do this and also how to specify DataSourceID for the detailTables since the DataSourceID in this case is Deprtments too.

I can access items in my department as follows (Without the grid)
Master Grid- Department.DepartmentID
DetailGrid - Department.Employee.EmployeeID

I would really appreciate if somebody can help me.

Thank you

Nick..

 

1 Answer, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 02 Dec 2009, 11:06 AM
Hello Nick,

The DataSourceId of the RadGrid is set to the ID of the data source controls (like SqlDataSource, AccessDataSource, ObjectDataSource, LinqDataSource, ObjectContainerDataSource,etc.) . In your case, you would have to make use of the DataSource property of the grid to bind the control to dataset object, i.e., RadGrid1.DataSource = object; .

Hope this helps..
Princy
Tags
Grid
Asked by
Nick Gohad
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Share this question
or