Expand all

4 posts, 0 answers
  1. HelloWorld
    HelloWorld avatar
    14 posts
    Member since:
    Jun 2013

    Posted 13 Jun 2013 Link to this post

    Hello,

    This code below is from one of demo code from

    TreeList - Forum with External Edit Form

    ExpandItemToLevel() is using 50 which seems a random number!!
    is there a way to find how many the level a item has to expand??

    Thanks!!
    case
     RadTreeList.ExpandCollapseCommandName:
    //if the command is fired for a root item by the LinkButton inside it, all child items should be expanded
    if ((e.Item as TreeListDataItem).HierarchyIndex.NestedLevel == 0 && e.CommandArgument.ToString() == "ExpandAll")
            {
                e.Canceled = true;
                if (!(e.Item as TreeListDataItem).Expanded)
                 {
                  ForumBoard.ExpandItemToLevel((e.Item as TreeListDataItem), 50);
      // 50 is a random number as Level to exand all I assume
      // is there a way to find how many level it has to expand??
                   }
                   else
                    {
                     ForumBoard.CollapseAllItems();
                     }
               }
                EditFormPanel.Visible = false;
                break
  2. Eyup
    Admin
    Eyup avatar
    3015 posts

    Posted 18 Jun 2013 Link to this post

    Hi Charlie,

    Have you tried the ExpandAllItems method?
    http://www.telerik.com/help/aspnet-ajax/treelist-server-side-basics.html
    ( Section Server-side Methods)

    Hope this works for you. Looking forward to your reply.

    Regards,
    Eyup
    Telerik
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. HelloWorld
    HelloWorld avatar
    14 posts
    Member since:
    Jun 2013

    Posted 18 Jun 2013 Link to this post

    I tried the ExpandAllItems method.
    the method expands every rows.
    I want to expand a particular item the user clicks to show every child items under the item.

    Thanks.
  5. Eyup
    Admin
    Eyup avatar
    3015 posts

    Posted 24 Jun 2013 Link to this post

    Hi Charlie,

    I am afraid there is no way to tell the max nested level depth of the item without expanding its child items. Therefore, you will need to use the ExpandItemToLevel approach with a big int number which would be practically impossible to reach. The method recursively traverses and toggles the expanded state of the child items and it will stop when there are no more items to expand.

    Hope the clarification was helpful.

    Regards,
    Eyup
    Telerik
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
Back to Top