Expand/Collapse All?

7 posts, 0 answers
  1. Peter
    Peter avatar
    95 posts
    Member since:
    Mar 2009

    Posted 29 Nov 2010 Link to this post

    Hi,

    Is there a way to programmatically expand/collapse all rows in the hierarchy? I don't care if it's server-side or client-side at this point.

    I had the idea of getting the INPUT element for the ExpandCollapseButton of each row and calling the click() function. However, forcing the exansion of a row causes a postback, hence I could not get the all to expand at once.

    Do you have any ideas?
  2. Martin
    Admin
    Martin avatar
    811 posts

    Posted 29 Nov 2010 Link to this post

    Hello Peter,

    You can use the ExpandAllItems and CollapseAllItems methods that RadTreeList server-side API provides. For more information you can review the following help article:

    Getting familiar with RadTreeList server-side API

    I hope this helps.

    Greetings,
    Martin
    the Telerik team
    Browse the vast support resources we have to jumpstart 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. UI for ASP.NET Ajax is Ready for VS 2017
  4. mr_dummy
    mr_dummy avatar
    4 posts
    Member since:
    Nov 2010

    Posted 20 Jan 2011 Link to this post

    hi, is there any way to expand all item that have the same attributes in all levers but don't affect any row that not having those attribute.
    beause the treelist only binds items that currently visible, so i can't set expand for all rows in the table
  5. Martin
    Admin
    Martin avatar
    811 posts

    Posted 25 Jan 2011 Link to this post

    Hello Peter,

    I am afraid that such a scenario is not possible. The problem would be to expand a child item that has the needed attribute while its parent item does not have it (and therefore is collapsed). Since the parent item is collapsed there is no way to expand the child one.

    My suggestion is to review this help topic and pay special attention to the ExpandItemToLevel(TreeListDataItem,int level) and ExpandToLevel(int level) methods which may be helpful for your scenario. 

    I hope this helps.

    All the best,
    Martin
    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.
  6. John
    John avatar
    24 posts
    Member since:
    Jan 2011

    Posted 23 May 2012 Link to this post

    I am trying to get a treelist to be initially expanded, but it is not working for me.

     I'm getting an error on the expandallitems() call. Apparently the method calls Databind which can't be called in NeedDataSource. Where can I put the call? Is there something I can do in the aspx page to expand the TreeList?

    Here's what I've got. 

            <telerik:RadTreeList ID="rtl_SAPDLD" runat="server" 
            ParentDataKeyNames="ParentID" DataKeyNames="ID"
            DataNavigateUrlField="WebAddress" AutoGenerateColumns="false"
            Skin="Default" style="margin-left: 15px" Width="800px">
                    <Columns>
                    <telerik:TreeListHyperLinkColumn DataTextField="Title" DataNavigateUrlFields="WebAddress"
    UniqueName="Title" Target="_blank" />
                </Columns>
        </telerik:RadTreeList>
     
     
        Private Sub rtl_SAProc_NeedDataSource(sender As Object, e As Telerik.Web.UI.TreeListNeedDataSourceEventArgs) Handles rtl_SAPDLD.NeedDataSource
            Dim SCMS As New SCMSdb
            Dim sp As New DataTable
     
            sp = SCMS.qrySAProcPDLDTree(lblMgmtSysID.Text.ToString)
            If sp.Rows.Count > 0 Then
                rtl_SAPDLD.DataSource = sp
                rtl_SAPDLD.ExpandAllItems()
                lblSAPDLD.Text = "The following Subject Areas, Procedures, Program Descriptions and Legacy documents are maintained by this Management System:"
                SAPDLD_PlaceHolder.Visible = True
            Else
                lblSAPDLD.Text = "This Management System maintains no Subject Areas, Procedures, Program Descriptions or Legacy documents. "
                SAPDLD_PlaceHolder.Visible = False
            End If
     
        End Sub
  7. Martin
    Admin
    Martin avatar
    811 posts

    Posted 24 May 2012 Link to this post

    Hello John,

    Have you tried whether calling ExpandAllItems on the PreRender event works for your scenario?

    Greetings,
    Martin
    the Telerik team
    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 their blog feed now.
  8. John
    John avatar
    24 posts
    Member since:
    Jan 2011

    Posted 24 May 2012 Link to this post

    I was finally able to get it to work by moving my code into Page_Load.

    Thanks, Martin!
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017