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

Expanding detailtable not working

4 Answers 46 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Johan Olofsson
Top achievements
Rank 1
Johan Olofsson asked on 17 Dec 2009, 09:38 AM
I have a simple RadGrid with one DetailTable and when I click on the expanding arrow the whole RadGrid collapses (even the MasterTable) and all i see is a line, like the one you see when you have a RadGrid without datasource.

    <telerik:RadGrid  
        ID="RadGrid1"  
        runat="server"   
        DataSourceID="ObjectDataSource1"  
        AutoGenerateColumns="False" 
        GridLines="None"
        <MasterTableView 
            DataSourceID="ObjectDataSource1"  
            DataKeyNames="Id"
            <Columns> 
                <telerik:GridBoundColumn DataField="Id" HeaderText="#" UniqueName="ID"
                </telerik:GridBoundColumn> 
                <telerik:GridBoundColumn DataField="ClientName" HeaderText="Client" UniqueName="ClientName"
                </telerik:GridBoundColumn> 
                <telerik:GridBoundColumn DataField="ContactPerson" HeaderText="Contact" UniqueName="ContactPerson"
                </telerik:GridBoundColumn> 
            </Columns> 
            <DetailTables> 
                <telerik:GridTableView  
                    DataSourceID="ObjectDataSource2"  
                    DataKeyNames="ClientId"
                    <ParentTableRelation> 
                        <telerik:GridRelationFields DetailKeyField="ClientId" MasterKeyField="Id" /> 
                    </ParentTableRelation> 
                    <Columns> 
                        <telerik:GridBoundColumn DataField="Id" HeaderText="Id" UniqueName="Id"></telerik:GridBoundColumn> 
                        <telerik:GridBoundColumn DataField="Text" HeaderText="Text" UniqueName="Text"></telerik:GridBoundColumn> 
                    </Columns> 
                </telerik:GridTableView> 
            </DetailTables> 
        </MasterTableView> 
    </telerik:RadGrid> 

4 Answers, 1 is accepted

Sort by
0
Pavlina
Telerik team
answered on 17 Dec 2009, 12:45 PM
Hello Johan, 

When you use different DataSourceID of every GridTableView, you need to set proper declarative relations.
For a live example that used declarative relations to generate a three-level hierarchy, see Three level hierarchy.

Please give it a try and let me know if you are still having issues implementing the functionality.

Best wishes,
Pavlina
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Lenny_shp
Top achievements
Rank 2
answered on 17 Dec 2009, 03:00 PM
I believe you also need ClientID as one of the column with display=off.
0
Johan Olofsson
Top achievements
Rank 1
answered on 18 Dec 2009, 10:15 AM
Unfortunately none of the above solutions work.

I ahve taken the code from the demo suggested in one of the above answers and just replaced the datasource with and ObejctDataSource instead of SqlDataSource. Are there any demos that uses ObjectDataSource?


0
Pavlina
Telerik team
answered on 19 Dec 2009, 04:03 PM
Hi Johan,

Attached to this message is a simple working application which handles the desired functionality. Please examine it and let me know if it works for you.

I hope this helps.

Best wishes,
Pavlina
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
Grid
Asked by
Johan Olofsson
Top achievements
Rank 1
Answers by
Pavlina
Telerik team
Lenny_shp
Top achievements
Rank 2
Johan Olofsson
Top achievements
Rank 1
Share this question
or