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

[Solved] How to set the datasource of amstertableview and detailsview to same thing?

1 Answer 112 Views
Grid
This is a migrated thread and some comments may be shown as answers.
matt
Top achievements
Rank 1
matt asked on 18 Jun 2008, 02:30 PM
The problem is normally the details takes a collection object from the parent which is fine in most cases but in this case I have an object for example

class person
{
string name
string job
string description
}

And I want each row to show NAME and JOB and when I expand that row
to should the details I want to show DESCRIPTION.

Is there any easy way to have the detailstable have access to get the DESCRIPTION? 

Hoping there is a cleaner way that using onDataBinding and reassign the datasource?

1 Answer, 1 is accepted

Sort by
0
Veli
Telerik team
answered on 20 Jun 2008, 09:15 AM
Hi Matt,

The easiest way is to bind the DetailTableView in the DetailTableDataBind method of RadGrid, using a new data source control (or data object) with the same parameters, except for a modified SELECT statement to select only the record associated with the parent item. Please find an attached sample project demonstrating this functionality:

protected void RadGrid1_DetailtableDataBind(object source, GridDetailTableDataBindEventArgs e) 
    AccessDataSource detailSource = new AccessDataSource(AccessDataSource1.DataFile, AccessDataSource1.SelectCommand + " WHERE SupplierID = " + e.DetailTableView.ParentItem["SupplierID"].Text); 
    e.DetailTableView.DataSource = detailSource; 


Regards,
Veli
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
Grid
Asked by
matt
Top achievements
Rank 1
Answers by
Veli
Telerik team
Share this question
or