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

Self-Referencing Heirarcy Not Working

0 Answers 70 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Digger
Top achievements
Rank 1
Digger asked on 16 Jun 2017, 11:39 AM

Have data as follows:

Column:  PrimaryKey: (Int32) ResourceId - not null

Column: (Int32?) : ParentId - can be null.

So top level ParentId fields for ResourceId's will be null.

<SelfHierarchySettings KeyName="ResourceId" ParentKeyName="ParentId" />

Do I have to use a NeedDataSource? Why?

Spent hours trying to get a seemingly simple 5 minute exercise to get a self-referencing grid to work.  Paging is off.  Googled and Stack-Overflow for hours - nobody has had this problem?  Help Please ?

Thanks..

<telerik:RadGrid ID="RGHWTreeView" runat="server" DataSourceID="EDS_BARHW" Width="100%"
                        AllowSorting="True" ShowStatusBar="True" ShowFooter="True" ShowGroupPanel="True" AutoGenerateColumns="False" AllowPaging="False"
                        OnItemInserted="theGrid_ItemInserted" OnItemUpdated="theGrid_ItemUpdated" OnItemDeleted="theGrid_ItemDeleted" OnPreRender="theGrid_PreRender"
                        OnItemCreated="theGrid_ItemCreated" OnItemDataBound="theGrid_ItemDataBound" OnItemCommand="theGrid_ItemCommand"
                        AllowAutomaticDeletes="True" AllowAutomaticInserts="True" AllowAutomaticUpdates="True" AutoGenerateHierarchy="False"
                        CellSpacing="0" GridLines="None" EnableHeaderContextMenu="True" OnDeleteCommand="theGrid_DeleteCommand" OnEditCommand="theGrid_EditCommand" OnInsertCommand="theGrid_InsertCommand">
                        <ClientSettings AllowColumnsReorder="True" AllowDragToGroup="True" ReorderColumnsOnClient="True" EnableRowHoverStyle="True" AllowColumnHide="True" AllowKeyboardNavigation="True" AllowRowHide="True" ColumnsReorderMethod="Reorder">
                            <DataBinding EnableCaching="False"></DataBinding>
                            <Selecting AllowRowSelect="True" />
                            <Scrolling AllowScroll="True" UseStaticHeaders="True" ScrollHeight="420px" />
                            <Resizing AllowColumnResize="True" AllowRowResize="True"></Resizing>
                            <Animation AllowColumnReorderAnimation="True"></Animation>
                        </ClientSettings>
                        <MasterTableView DataSourceID="EDS_BARHW" DataKeyNames="ResourceId,ParentId,Owner" CssClass="w3-tiny" Name="Hardware Detail: " Caption="HW Tree Detail"
                            AllowMultiColumnSorting="True" EnableHeaderContextAggregatesMenu="True" EnableHeaderContextFilterMenu="False"
                            CommandItemDisplay="Top" EditMode="EditForms" AllowFilteringByColumn="False"
                            AllowSorting="True" ShowHeadersWhenNoRecords="True" AllowPaging="False" PageSize="20">
                            <SelfHierarchySettings KeyName="ResourceId" ParentKeyName="ParentId" />
                            <CommandItemSettings AddNewRecordText="New Hardware Resource"
                                ShowExportToCsvButton="True" ShowExportToExcelButton="True" ShowExportToWordButton="True" ShowAddNewRecordButton="True"></CommandItemSettings>
                            <RowIndicatorColumn FilterControlAltText="Filter RowIndicator column" Visible="True"></RowIndicatorColumn>
                            <ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column"></ExpandCollapseColumn>
                            <Columns>

No answers yet. Maybe you can help?

Tags
Grid
Asked by
Digger
Top achievements
Rank 1
Share this question
or