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

Hierarchical data in grid

1 Answer 62 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Martin van der Graaff
Top achievements
Rank 1
Martin van der Graaff asked on 16 Apr 2010, 02:02 PM

I'm trying to create a hierarchical grid with 3 levels.

I get these 3 levels, but on the child levels I get all data, so the parent/child view relations seem to be ignored, what am i doing wrong?

Thanks in advance.

Martin

<%@ Page Title="" Language="C#" MasterPageFile="~/PresentationLayer/MyProject.Master" AutoEventWireup="true" CodeBehind="AA.aspx.cs" Inherits="Projects.MyProject.PresentationLayer.AA" %>
<%@ Register assembly="Telerik.Web.UI" namespace="Telerik.Web.UI" tagprefix="telerik" %>
<%@ Register assembly="Infragistics35.Web.v10.1, Version=10.1.20101.1011, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb" namespace="Infragistics.Web.UI.DataSourceControls" tagprefix="ig" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <asp:Label ID="lblPageTitle" runat="server" CssClass="pagetitle" Text="Telerik (Grid)"
        Height="50px" Width="100%"></asp:Label>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="ContentPlaceHolder" runat="server">

            <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
            <AjaxSettings>
                <telerik:AjaxSetting AjaxControlID="RadGrid1">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="RadGrid1" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
            </AjaxSettings>
        </telerik:RadAjaxManager>

 <telerik:RadGrid ID="RadGrid1" OnPreRender="RadGrid1_PreRender" ShowStatusBar="true" DataSourceID="ObjectDataSource1"
            runat="server" AutoGenerateColumns="False" PageSize="7" AllowSorting="True" AllowMultiRowSelection="False"
            AllowPaging="True" GridLines="None">
            <PagerStyle Mode="Advanced"></PagerStyle>
            <MasterTableView DataSourceID="ObjectDataSource1" DataKeyNames="EnvironmentType" AllowMultiColumnSorting="True">
                <DetailTables>
                    <telerik:GridTableView DataKeyNames="OrganizationID, EnvironmentType" DataSourceID="ObjectDataSource2" Width="100%"
                        runat="server">
                        <ParentTableRelation>
                            <telerik:GridRelationFields DetailKeyField="EnvironmentType" MasterKeyField="EnvironmentType" />
                        </ParentTableRelation>
                        <DetailTables>
                            <telerik:GridTableView DataKeyNames="OrganisationID, EnvironmentType" DataSourceID="ObjectDataSource3" Width="100%"
                                runat="server">
                                <ParentTableRelation>
                                    <telerik:GridRelationFields DetailKeyField="OrganisationID" MasterKeyField="OrganizationID" />
                                    <telerik:GridRelationFields DetailKeyField="EnvironmentType" MasterKeyField="EnvironmentType" />
                                </ParentTableRelation>
                                <Columns>
                                    <telerik:GridBoundColumn SortExpression="LocatieID" HeaderText="LocatieID" HeaderButtonType="TextButton"
                                        DataField="LocatieID" UniqueName="LocatieID">
                                    </telerik:GridBoundColumn>
                                    <telerik:GridBoundColumn SortExpression="Locatiename" HeaderText="Locatiename" HeaderButtonType="TextButton"
                                        DataField="Locatiename" UniqueName="Locatiename">
                                    </telerik:GridBoundColumn>
                                          <telerik:GridBoundColumn SortExpression="OrganisationID" HeaderText="OrganisationID" HeaderButtonType="TextButton"
                                        DataField="OrganisationID" UniqueName="OrganisationID">
                                    </telerik:GridBoundColumn> 
                                        <telerik:GridBoundColumn SortExpression="EnvironmentType" HeaderText="EnvironmentType" HeaderButtonType="TextButton"
                                        DataField="EnvironmentType" UniqueName="EnvironmentType">
                                    </telerik:GridBoundColumn> 
                                </Columns>
                            </telerik:GridTableView>
                        </DetailTables>
                        <Columns>
                            <telerik:GridBoundColumn SortExpression="OrganizationID" HeaderText="OrganizationID" HeaderButtonType="TextButton"
                                DataField="OrganizationID" UniqueName="OrganizationID">
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn SortExpression="Name" HeaderText="Name" HeaderButtonType="TextButton"
                                DataField="Name" UniqueName="Name"">
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn SortExpression="EnvironmentType" HeaderText="EnvironmentType" HeaderButtonType="TextButton"
                                DataField="EnvironmentType" UniqueName="EnvironmentType">
                            </telerik:GridBoundColumn>
                        </Columns>
                    </telerik:GridTableView>
                </DetailTables>
                <Columns>
                    <telerik:GridBoundColumn SortExpression="EnvironmentType" HeaderText="EnvironmentType" HeaderButtonType="TextButton"
                        DataField="EnvironmentType" UniqueName="EnvironmentType">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn SortExpression="Name" HeaderText="Name" HeaderButtonType="TextButton"
                        DataField="Name" UniqueName="Name">
                    </telerik:GridBoundColumn>
                </Columns>
            </MasterTableView>
        </telerik:RadGrid>   

    <asp:ObjectDataSource ID="ObjectDataSource3" runat="server"
        OldValuesParameterFormatString="original_{0}" SelectMethod="GetLocations"
        TypeName="Projects.MyProject.BusinessLayer.HubEnvironmentDataUniterComponentStatusHDP">
    </asp:ObjectDataSource>
    <asp:ObjectDataSource ID="ObjectDataSource2" runat="server"
        OldValuesParameterFormatString="original_{0}" SelectMethod="GetOrganisations"
        TypeName="Projects.MyProject.BusinessLayer.HubEnvironmentDataUniterComponentStatusHDP">
    </asp:ObjectDataSource>
    <asp:ObjectDataSource ID="ObjectDataSource1" runat="server"
        OldValuesParameterFormatString="original_{0}" SelectMethod="GetEnvironments"
        TypeName="Projects.MyProject.BusinessLayer.HubEnvironmentDataUniterComponentStatusHDP">
        <SelectParameters>
            <asp:SessionParameter Name="envTypeFilter" SessionField="EnvironmentTypeFilter"
                Type="Int32" />
        </SelectParameters>
    </asp:ObjectDataSource>
</asp:Content>
t="server" ID="Footer1"></telerik:Footer>
    </form>
</body>
</html>
--%>

1 Answer, 1 is accepted

Sort by
0
Pavlina
Telerik team
answered on 19 Apr 2010, 10:13 AM
Hi Martin,

I reviewed the setup, and the code looks correct. However, I suggest you review the articles below and let me know if they help to achieve your goal.
Understanding hierarchical grid structure
Hierarchical data-binding using declarative relations

Sincerely yours,
Pavlina
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
Martin van der Graaff
Top achievements
Rank 1
Answers by
Pavlina
Telerik team
Share this question
or