I have tried for 7 hours to change my child node column to no avail.
I have a Tree bound to a datasource with a relationship. The root node displays the correct column from the datatable but the child node is displaying the second column from the relationed. Sadly this column is the foreignkey for my relationship. How do I get the child node to display the 3rd column instead?
I am using outlookexpress viewmode here.
I have in my primary table :- IndustryID, IndustryName, Note, Rating
and my secondary table :- SkillID, IndustryID, SkillName, Note
Relationship is based on the IndustryID
My tree shows the Root node (IndustryName) and ChildNode(IndustryID). I would like the child to show SkillName.
sample code will go a long way here.
Hi,
The child nodes will display in a grid style by default and thus it will show all of the fields of the child data, not just one field. It sounds like you have set it up in such a way that the child nodes show in Standard mode - so there's no grid, they just show up as nodes with text.
When a bound node displays in Standard style, it will default to displaying the first field in the data as it's text. To change this, you have to set the NodeTextColumn property on the ColumnSet which is applied to those nodes. If you are manually creating your ColumnSets, then you would set it there. If you are letting the tree auto-generate the ColumnSets, then you could do this in the ColumnSetGenerated event.
Yes I am using standard/ outlookexpress not grid.
I have tried the NodeTextColumn and I am only able to change the display field for the root node. I can't find reference to the childnode.
I did notice that the ColumnSetGenerated gets fired twice. Once for the Primary table and a second time for the relationship table (which is identical in schema to the primary table).
My temporary workaround just now is to change the ordinal position of the column in my datatable before passing it to the list. but this is not ideal and presents a management issue.
this is the line I use for the parent node in ColumnSetGenerated;
e.ColumnSet.NodeTextColumn = e.ColumnSet.Columns("Industry")
imagehq said:The data for the project is in MS SQL and we have a class library that retrieves the data and returns the table. Creating a sample project to post will take me a considerable amount of time which is not practical at this time. I have resorted to using a different tree component.
There's no reason why a small sample project would need to access your real data. You could create some fake data using something like a DataTable in memory, or an UltraDataSource. But I understand if time does not permit this, either.
I have a sample project Now. How do I attach a file to this post?
I have uploaded the file under my profile. I hope it is accessible.
The file is called uTree.zip and is a vb.net project using 2010.1
You will notice I am trying to show the TaskName in the childnode which is the last column but this is not happening
Hello,
When you compose this post you will see three tabs compose, options, preview. If you go to options tab you will see Add/Update button which will allow you to add a file to this post.
Thanks, I have added the file now.
You are the man. Thanks a lot. So much easier when you know how.
Okay, I see the issue now. I was under the impression that you are showing stand-style nodes, but that's not the case. So the NodeTextColumn will do nothing here.
You are using OutlookExpress ViewStyle and just hiding all but one column. So what you have to do in a case like this where you are using OutlookExpress style and you have different ColumnSets for each band, is map the child column to the parent column you want. You do this using the MapToColumn property on the column.
#Region " ColumnSet Generated " Private Sub ultraTree1_ColumnSetGenerated(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinTree.ColumnSetGeneratedEventArgs) Handles UltraTree1.ColumnSetGenerated Dim tree As UltraTree = CType(sender, UltraTree) If e.ColumnSet.Key = "Project" Then 'e.ColumnSet.NodeTextColumn = e.ColumnSet.Columns("TaskName") e.ColumnSet.Columns("TaskName").MapToColumn = "ProjectName" End If If e.ColumnSet.Key = "Projects" Then For Each _col As UltraWinTree.UltraTreeNodeColumn In e.ColumnSet.Columns _col.Visible = False Next e.ColumnSet.Columns("Project").Visible = True e.ColumnSet.Columns("ProjectName").Visible = True e.ColumnSet.NodeTextColumn = e.ColumnSet.Columns("ProjectName") End If End Sub#End Region
Any luck with the files?