TreeList Sort Icon is not shown

8 posts, 0 answers
  1. Daniel
    Daniel avatar
    11 posts
    Member since:
    Oct 2011

    Posted 11 Feb 2013 Link to this post

    Hello,

    We use the TreeList control in our ASP .NET 4, C# application (running on Internet Explorer).
    In a page we have a Repeater of Update Panels. Each Update Panel contains a TreeList. All TreeLists have the same behaviour. They have multiple sorting enabled, and by default they are sorted by 2 columns (Class, ID). When sorting by some other column (Example: State), we adjust the Sorting Expressions from (Class, ID, State) to (State, ID). The sorting icon is not visible on the State column, but we have a simple button with no text on the Class column.

    Do you have any idea what could be the cause for this problem?

    Thank you.
  2. Andrey
    Admin
    Andrey avatar
    836 posts

    Posted 14 Feb 2013 Link to this post

    Hi,

    Most probably the problem comes from a missing styles that will be applied to the button. What skin are you using? Could you try to change the applied skin to one of the other built-in skins and check whether the issue still replicates?

    Regards,
    Andrey
    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Daniel
    Daniel avatar
    11 posts
    Member since:
    Oct 2011

    Posted 14 Feb 2013 Link to this post

    Hello,

    I found the problem. Was not related to the skin, but somehow led me to the solution.
    We create the tree dynamicaly in the Page_Init event of our user control. I moved the code that adds the columns to the Columns collection in the NeedDataSource event, and now it works ok.

  5. Andrey
    Admin
    Andrey avatar
    836 posts

    Posted 19 Feb 2013 Link to this post

    Hi,

    Thank you for getting back to us.

    You should not create the structure of RadTreeList on NeedDataSource event. As this help topic says you should create the structure of RadTreeList on Page_Init or Page_Load event. If the RadTreeList is declaratively defined in the mark-up you should define the structure of RadTreeList in the Page_Load event.

    Then check whether the problem still replicates.

    All the best,
    Andrey
    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.
  6. Daniel
    Daniel avatar
    11 posts
    Member since:
    Oct 2011

    Posted 27 Feb 2013 Link to this post

    Hello,

    The problem still replicates. I will paste some sections of the code to see better how I create my tree.
    Main page: on Page_Load event I creat the list of UserControls RolloutTree.ascx

    List<TreeListColumn> collection = GetTreeListColumns(out countOfProject, out countOfRegionHeaders, out countOfBuHeaders, out listBUcolumnsIndex);
     
    for (int i = fromIndex; i <= toIndex; i++)
    {
    ProjectRollout.LocationData locationData = projectsForLocation[i - 1];
    RolloutTree treeControl = Page.LoadControl("~/Modules/Reporting/Controls/RolloutTree.ascx") as RolloutTree;
    treeControl.ID = "rolloutTree" + i;
    treeControl.Data = locationData.Projects;
    treeControl.Location = locationData.Name;
    treeControl.ListTreeListColumns = collection;
    treeControl.CountOfBuHeaders = countOfBuHeaders;
    treeControl.CountOfProject = countOfProject;
    treeControl.CountOfRegionHeaders = countOfRegionHeaders;
    treeControl.ListBUcolumnsIndex = listBUcolumnsIndex;
    treeControl.DivisionsWithCounterDictionary = divisionsWithCounterDictionary;
    treeListDiv.Controls.Add(treeControl);
    }

    On the User Control page I have on Page_Init event:

    RadTreeListLocations = new RadTreeList
    {
    ID = "RadTreeListLocations",
    DataKeyNames = new string[] { "ID" },
    ParentDataKeyNames = new string[] { "MasterProjectID" },
    AutoGenerateColumns = false,
    EnableEmbeddedSkins = false,
    EnableViewState = true,
    Skin = "PMTOrangeSkin",
    BorderColor = System.Drawing.Color.White,
    AllowSorting = true,
    AllowNaturalSort = false
    };
     
    foreach (var column in ListTreeListColumns)
    {
    RadTreeListLocations.Columns.Add(column);
    }
     
    RadTreeListLocations.NeedDataSource += new EventHandler<TreeListNeedDataSourceEventArgs>(RadTreeListLocations_NeedDataSource);
    RadTreeListLocations.ItemCreated += new EventHandler<TreeListItemCreatedEventArgs>(RadTreeListLocations_ItemCreated);
    RadTreeListLocations.ItemDataBound += new EventHandler<TreeListItemDataBoundEventArgs>(RadTreeListLocations_ItemDataBound);
     
    treeListUpdatePanel.ContentTemplateContainer.Controls.Add(RadTreeListLocations);

    On the RadTreeListLocations_NeedDataSource event I have:

    RadTreeList radTreeListLocations = (RadTreeList)sender;
    if (Data != null)
    {
    radTreeListLocations.DataSource = Data;
    if (radTreeListLocations.SortExpressions.Count == 0)
    {
    radTreeListLocations.AllowMultiColumnSorting = true;
    radTreeListLocations.SortExpressions.AddSortExpression(new TreeListSortExpression()
    {
    FieldName = "Class",
    SortOrder =
    TreeListSortOrder.Ascending                           
    });
     radTreeListLocations.SortExpressions.AddSortExpression(new TreeListSortExpression()
    {
    FieldName = "ID",
    SortOrder =
    TreeListSortOrder.Ascending
    });
    }
    ReportingHelper.AddIDSortingCriteria(radTreeListLocations);               
    }
    else
    {
    radTreeListLocations.DataSource = new DataTable();
    }

    If I add the columns here, at the end of the NeedDataSource event, the sorting works correct, but when I try to make other actions, the style of the tree is lost.

    What can I do?
    Thank you.
  7. Andrey
    Admin
    Andrey avatar
    836 posts

    Posted 28 Feb 2013 Link to this post

    Hi,

    Why you are separating the column creation and the TreeList creation? Try to create the columns in the same event where you instantiate the TreeList and check again whether the problem replicates.

    Regards,
    Andrey
    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. Daniel
    Daniel avatar
    11 posts
    Member since:
    Oct 2011

    Posted 01 Mar 2013 Link to this post

    Hello.

    Yes, I create the columns imediately after the tree creation, in the Page_Init event. This is the case when the problem replicates. That's why I was trying other scenarios.
    I don't know what could I do.
  9. Andrey
    Admin
    Andrey avatar
    836 posts

    Posted 06 Mar 2013 Link to this post

    Hello,

    There should be no problem with this approach. I made a sample project to test the case and it is working as expected on my side. Give it a try and check whether it is working on your side.

    All the best,
    Andrey
    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.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017