Setting the parent in the middle of a tree

3 posts, 0 answers
  1. chrisL
    chrisL avatar
    64 posts
    Member since:
    Dec 2005

    Posted 13 Apr 2011 Link to this post

    Hi there.

    I have a large organisational structure. When I load my page showing details of an item half way down the tree I want to load my RadTreeList using the selected item as the parent so that it only shows the current item as the parent and then all its children. Anything above it is ignored. So I'm specifying a dynamic starting parentID essentially

  2. Veli
    Veli avatar
    2002 posts

    Posted 14 Apr 2011 Link to this post

    RadTreeList does not support specifying the default values for the keys of root items. It looks for items whose data key values have a default value (e.g.  0 for int, null for nullable, etc.) If you need to specify a set of data items that do not have items that qualify as root in RadTreeList terms, you need to modify your data. For example, you can iterate over the data items, identify the roots, set their data key values to their defaults and add the modified items in a custom collection. Then you can pass RadTreeList this modified collection when databinding.

    the Telerik team

    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

  3. chrisL
    chrisL avatar
    64 posts
    Member since:
    Dec 2005

    Posted 15 May 2011 Link to this post

    I created an easy SQL only solution to setting the TreeList control to whatever point within my org tree.

    Using a CASE statement in my select statement, if the ChildID equals where I want to start my tree I set the ParentOUID to 0. E.g.

    <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:SiteSqlServer %>" SelectCommand="SELECT TOP (100) PERCENT dbo._OFLENZ0001OURelationship.OUFacilityID, CASE WHEN dbo._OFLENZ0001OU.OUID = @OUID THEN 0 ELSE dbo._OFLENZ0001OURelationship.ParentOUID END as ParentOUID, dbo._OFLENZ0001OU.OUID, dbo._OFLENZ0001OU.TenantID, dbo._OFLENZ0001OU.OrganisationName, dbo._OFLENZ0001OU.OUCode, dbo._OFLENZ0001OU.Address, dbo._OFLENZ0001OU.City, dbo._OFLENZ0001OU.OUGUID FROM dbo._OFLENZ0001OU INNER JOIN dbo._OFLENZ0001OURelationship ON dbo._OFLENZ0001OU.OUID = dbo._OFLENZ0001OURelationship.ChildOUID WHERE (dbo._OFLENZ0001OURelationship.IsProgramRelatedRelationship = 0) AND (dbo._OFLENZ0001OU.TenantID = 2) ORDER BY dbo._OFLENZ0001OU.TenantID, dbo._OFLENZ0001OU.OUID">
            <asp:QueryStringParameter Name="OUID" QueryStringField="o" DbType="Int32" />
            <asp:SessionParameter Name="TenantID" SessionField="TenantID" DbType="Int32" />

    Hope this helps someone.

Back to Top