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

[Solved] Self-referencing detailtable

2 Answers 190 Views
Grid
This is a migrated thread and some comments may be shown as answers.
J-P Minderhoud
Top achievements
Rank 1
J-P Minderhoud asked on 16 Apr 2008, 07:39 AM
Hi all,

I have been at this for half a day now but can't seem to get it to work.

I have 2 sets of data, A and B of which the B has a foreignkey relation to A and has a self referring foreign key.
What I want to achieve is that the mastertableview is populated with the data from  A and each record has self-referencing detailtables populated with the data from B. But that doesn't seem to work.

When I load the data from B into a self-referencing mastertableview, as shown in the examples, the data shows hierarchical.
But when I try my grid (shown below) and load the DetailTableView with the correct datasource using the DetailTableDataBind event the detailtable shows all the data as one level and not hierarchical and each row does have a expand icon which when clicked opens a "No Data Found" detail table.

<rad:RadGrid id="grid1" runat="server" AllowSorting="true" AllowPaging="false" Width="100%"
    <ClientSettings AllowExpandCollapse="true"
        <Scrolling AllowScroll="True" UseStaticHeaders="true" ScrollHeight="100%" /> 
        <ClientEvents OnGridCreated="ResizeGrid"  /> 
    </ClientSettings> 
    <MasterTableView DataKeyNames="Id"
        <DetailTables> 
            <rad:GridTableView 
              HierarchyDefaultExpanded="false" 
              FilterExpression="SfpId = 0" 
              ShowHeader="false" 
              AllowSorting="False" 
              width="100%" 
              ShowHeadersWhenNoRecords="false" 
              EnableNoRecordsTemplate="false" 
              DataKeyNames="Id,SfpId"
                <SelfHierarchySettings ParentKeyName="SfpId" KeyName="Id" /> 
                <columns> 
                    <rad:GridBoundColumn DataField="Title" /> 
                </columns> 
            </rad:GridTableView> 
        </DetailTables> 
        <Columns> 
            <rad:GridBoundColumn DataField="Title" /> 
        </Columns> 
    </MasterTableView> 
</rad:RadGrid> 

To me it seems that the the FilterExpression for a detail GridTableView is not used or does not work. Or is what I'm trying to achieve not possible at all? Or am I doing something else wrong?

I'm using the Q1 2008 futures build.

Thanx for the help.

Regards,
J-P

2 Answers, 1 is accepted

Sort by
0
J-P Minderhoud
Top achievements
Rank 1
answered on 17 Apr 2008, 08:22 AM
I've upgraded to the new official release build, but still no luck.

0
Iana Tsolova
Telerik team
answered on 17 Apr 2008, 03:51 PM
Hello J-P Minderhoud,

You could achieve the desired functionality if you use NestedViewTemplate and inside it define self-referencing hierarchy grid instead of using detail tables. Please visit our NestedViewTemplate online demo for further information.

Kind regards,
Iana
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
Grid
Asked by
J-P Minderhoud
Top achievements
Rank 1
Answers by
J-P Minderhoud
Top achievements
Rank 1
Iana Tsolova
Telerik team
Share this question
or