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

Radtreelist problem to extend the nodes

1 Answer 18 Views
TreeList
This is a migrated thread and some comments may be shown as answers.
Jerome MAILLEY
Top achievements
Rank 1
Jerome MAILLEY asked on 20 Apr 2017, 03:45 PM

Hello,

I have a radtreelist and I would like to extend a node according to the objects.

this is the .ascx side code :

<telerik:RadTreeList ID="WindowDynamicGrid" runat="server" AllowPaging="false" RenderMode="Lightweight"
    Skin="Metro" DataKeyNames="NodeId" ParentDataKeyNames="ParentId" ClientDataKeyNames="Value" Width="800px"
    AllowSorting="false" AllowFilteringByColumn="false" GridLines="None" OnNeedDataSource="WindowGrid_NeedDataSource"
    AutoGenerateColumns="false" AllowMultiRowSelection="false" ExpandCollapseMode="Client">
    <Columns>
        <telerik:TreeListSelectColumn HeaderStyle-Width="20" visible="true" /> 
    </Columns>
    <ClientSettings>
        <ClientEvents OnTreeListCreated="OnTreeListCreated" />
        <Selecting AllowItemSelection="true" />
        <Scrolling AllowScroll="True" UseStaticHeaders="True" SaveScrollPosition="true" />
    </ClientSettings>
</telerik:RadTreeList>

And this is the .ascx.cs side code :

protected void Page_PreRender(object sender, EventArgs e)
 {
        var expandedOrSelectedItems = controlItems.Cast<HierarchicalComboBoxItem>().Where(i => i.Checked || i.Expanded);
        foreach (var expandedOrSelectedItem in expandedOrSelectedItems)
        {
            var item = WindowDynamicGrid.FindItemByKeyValue("NodeId", expandedOrSelectedItem.NodeId);
            if (item != null)
            {
                item.Expanded = expandedOrSelectedItem.Expanded;
                item.Selected = expandedOrSelectedItem.Checked;
            }
       }
}

Do you have an idea of my problem ?

Thank you

I have a radtreelist and I would like to extend a node according to my objects to the pre_render

1 Answer, 1 is accepted

Sort by
0
Marin Bratanov
Telerik team
answered on 24 Apr 2017, 12:32 PM

Hello,

I suggest you try expanding the items with the methods the TreeList provides instead of using properties: http://docs.telerik.com/devtools/aspnet-ajax/controls/treelist/items/expand-collapse-items.

Regards,

Marin Bratanov
Telerik by Progress
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
TreeList
Asked by
Jerome MAILLEY
Top achievements
Rank 1
Answers by
Marin Bratanov
Telerik team
Share this question
or