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

Treelist performance

1 Answer 141 Views
TreeList
This is a migrated thread and some comments may be shown as answers.
David
Top achievements
Rank 1
David asked on 07 Mar 2011, 04:51 PM

I have inherited an application from a previous developer and I am having problems with the speed of the RadTreeList he has previously implemented.

 


The Treelist is a representation of a dealer hierarchy where the sub branches roll up to a principal dealer within a country.

 


Eg Principal Dealer 11020000

 

Has branches:  11020001, 11020002, 11020003

 


For each row we are displaying name and address information as well as image buttons that allow a dealer to be selected/assigned to a role holder or for all dealers for a principal to be selected at principal level.

 


This is using the NeedDataSource event.

 

 


Now I am caching data from my SQL Server 2008 datasource wherever I can but I am finding that expanding nodes at principal level and performing updates is painfully slow. Even at it’s largest for a single country the treelist only has around 2000 records and the round trips to the server to get data and perform updates look pretty quick.

 


I have been through all of the performance tips on the site but nothing seems to be improving it i.e.  RadCompression etc.

 


Can you suggest anything that might be available to improve performance?


<telerik:RadAjaxPanel ID="RadAjaxPanel3" LoadingPanelID="RadAjaxLoadingPanel2" runat="server">
    <telerik:RadTreeList AutoGenerateColumns="false" runat="server" ID="RadTreeList3"  
        ShowTreeLines="false" AllowMultiItemSelection="true" DataKeyNames="DLR_CD" ParentDataKeyNames="DLR_PRNCPL_ACC_CD"
        OnNeedDataSource="RadTreeList3_NeedDataSource" OnDataBound="RadTreeList3_DataBound"
        AllowPaging="true" PageSize="10" OnItemDataBound="RadTreeList3_ItemDataBound"
        OnItemCreated="RadTreeList3_ItemCreated">
        <Columns>
            <telerik:TreeListTemplateColumn HeaderText="Dealer" DataField="DLR_CD" UniqueName="DLR_CD">
                <ItemTemplate>
                    <asp:Label ID="lblDlrCd" runat="server" Text='<%# Eval("DLR_CD") %>' />
                    <asp:Label ID="Label1" Width="20px" runat="server" />
                    <asp:ImageButton ID="btnSelectAll" ToolTip="Click to assign all dealers for Principal"
                        Visible="false" OnClick="btnSelectAll_OnClick" runat="server" ImageUrl="~/Images/ok_16.png" />
                    <asp:ImageButton ID="btnUnSelectAll" ToolTip="Click to un-assign all dealers for Principal"
                        Visible="false" OnClick="btnUnSelectAll_OnClick" runat="server" ImageUrl="~/Images/remove_16.png" />
                    <asp:HiddenField ID="hdDlrPrin" runat="server" Value='<%# Eval("DLR_PRNCPL_ACC_CD") %>' />
                    <asp:HiddenField ID="hdUser" runat="server" Value='<%# Eval("USR_BUSN_ROLE_ID") %>' />
                    <asp:HiddenField ID="hdDlrUsr" runat="server" Value='<%# Eval("DLR_USR_MAP_ID") %>' />
                </ItemTemplate>
            </telerik:TreeListTemplateColumn>
            <telerik:TreeListTemplateColumn HeaderText="Assign?">
                <ItemTemplate>
                    <asp:ImageButton ID="btnSelect" ToolTip="Click to assign this dealer" Visible="false"
                        OnClick="btnSelect_OnClick" runat="server" ImageUrl="~/Images/ok_16.png" />
                    <asp:ImageButton ID="btnUnSelect" ToolTip="Click to un-assign this dealer" Visible="false"
                        OnClick="btnUnSelect_OnClick" runat="server" ImageUrl="~/Images/remove_16.png" />
                </ItemTemplate>
            </telerik:TreeListTemplateColumn>
            <telerik:TreeListTemplateColumn HeaderText="Dealer Assigned">
                <ItemTemplate>
                    <asp:Panel ID="pnlTick" runat="server">
                        <asp:Label ID="lblTick" runat="server" Text="Y" Style="font-weight: bold;"></asp:Label>
                    </asp:Panel>
                </ItemTemplate>
            </telerik:TreeListTemplateColumn>
            <telerik:TreeListBoundColumn DataField="DLR_NM" UniqueName="DLR_NM" HeaderText="Name" />
            <telerik:TreeListBoundColumn DataField="DLR_ADDR1" UniqueName="DLR_ADDR1" HeaderText="Address 1" />
            <telerik:TreeListBoundColumn DataField="DLR_POST_CD" UniqueName="DLR_POST_CD" HeaderText="Post Code" />
            <telerik:TreeListBoundColumn DataField="DLR_CITY" UniqueName="DLR_CITY" HeaderText="City" />
            <telerik:TreeListBoundColumn DataField="DLR_VISN_REGN_NM" UniqueName="DLR_VISN_REGN_NM"
                HeaderText="Region" />
        </Columns>
    </telerik:RadTreeList>


protected void RadTreeList3_NeedDataSource(object sender, TreeListNeedDataSourceEventArgs e)
    {
        try
        {
            if (Dlr_Cd != null && Dlr_Cd != string.Empty)
            {
                txFind.Text = Dlr_Cd;
                Dlr_Cd = string.Empty;
            }  
  
            GetData(Cntry_Cd, (txFind.Text.Trim() != string.Empty ? txFind.Text.Trim() : string.Empty),Brand_ID);
            RadTreeList3.DataSource = cache_Data;
        }
        catch (Exception ex)
        {
            string s = ex.Message;
        }
    }
  
  
  
 protected void GetData(string cntry, string dlr_nm,string brand_id)
    {
        if (cache_Data == null || cache_Data.Tables.Count == 0)
        {
            CDMAI cDMAI = new CDMAI();
            cDMAI.DLR_MyDealer_List_All(cntry, dlr_nm,brand_id );
            cache_Data = cDMAI.RetDataSet;
        }
    }

1 Answer, 1 is accepted

Sort by
0
Veli
Telerik team
answered on 09 Mar 2011, 10:16 AM
Hi David,

Most of RadTreeList's commands like expand/collapse, page and sort are rebinding commands. This means RadTreeList will need to rebind every time one of these commands are initiated. Rebinding means RadTreeList needs to build a hierarchical tree from all the records in the data source. In effect, traversing all the data on each rebind is inevitable. The only suggestion we can make is to reduce the number of records in the data source.

Veli
the Telerik team
Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
Tags
TreeList
Asked by
David
Top achievements
Rank 1
Answers by
Veli
Telerik team
Share this question
or