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

TreeList Sort Icon is not shown

7 Answers 134 Views
TreeList
This is a migrated thread and some comments may be shown as answers.
Attila
Top achievements
Rank 1
Attila asked on 11 Feb 2013, 11:07 AM
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.

7 Answers, 1 is accepted

Sort by
0
Andrey
Telerik team
answered on 14 Feb 2013, 09:21 AM
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.
0
Attila
Top achievements
Rank 1
answered on 14 Feb 2013, 12:00 PM
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.

0
Andrey
Telerik team
answered on 19 Feb 2013, 09:51 AM
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.
0
Attila
Top achievements
Rank 1
answered on 27 Feb 2013, 08:57 AM
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.
0
Andrey
Telerik team
answered on 28 Feb 2013, 02:30 PM
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.
0
Attila
Top achievements
Rank 1
answered on 01 Mar 2013, 08:48 AM
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.
0
Andrey
Telerik team
answered on 06 Mar 2013, 07:30 AM
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.
Tags
TreeList
Asked by
Attila
Top achievements
Rank 1
Answers by
Andrey
Telerik team
Attila
Top achievements
Rank 1
Share this question
or