Home - Forums-.NET - FlyTreeView (ASP.NET) - Need help retrieving node ID

FlyTreeView (ASP.NET)

Technical support and KB related to the FlyTreeView control

This forum related to following products: FlyTreeView for ASP.NET

Need help retrieving node ID
Link Posted: 04-Apr-2009 11:57
I am fairly new to web programming so apologies if I don’t make sense. I am creating a dataset and populating the treeview via ConvertTabularDataToHierarchical(). I would like to then use the original ID I passed in to this function to be accessable back at the server so I can export the node text and ID back to the database again.

I have found a very longwinded way through the asp.net page to get the ID from the ConvertTabularDataToHierarchical() import and add it to ‘.value’ then export out that way but I’m guessing theres an easier method. Any help would be greatly appriciated!

Heres the long winded way in VB...

        For Each node In flyTreeView2.Nodes
            'dim originalTabularDataItem = ((IHierarchyData)e.Node.DataItem).Item
            Dim originalTabularDataItem As IHierarchyData = node.DataItem
            Dim dataRowView As DataRowView = originalTabularDataItem.Item
            node.Value = DirectCast(DirectCast(DirectCast(originalTabularDataItem.Item, System.Object), System.Data.DataRowView).Row, System.Data.DataRow).ItemArray(0)

            If node.ChildNodes.Count > 0 Then
                UpdateChildNodeValue(sb, node, nodeCount)
            End If
        Next
Link Posted: 05-Apr-2009 07:25
So do you need to put something into node.Value property when data binding?

If yes, then there are several ways.
First, you can just add FlyNodeBinding to FlyTreeView.DataBindings collection. So that FlyNodeBinding.ValueField="field_name_that_you_need_to_put_into_id"

Or you can handle NodeDataBound event so that you can modify node the way you need (you can alwats get node.DataItem and cast it to what you need to get required property from it). So here you just do node.Value = ((yourdataitemtype)node.DataItem).YourPropertyOrWhatever.
Link Posted: 10-May-2009 16:25
[quote="EvgenyT"]So do you need to put something into node.Value property when data binding?

If yes, then there are several ways.
First, you can just add FlyNodeBinding to FlyTreeView.DataBindings collection. So that FlyNodeBinding.ValueField="field_name_that_you_need_to_put_into_id"

Or you can handle NodeDataBound event so that you can modify node the way you need (you can alwats get node.DataItem and cast it to what you need to get required property from it). So here you just do node.Value = ((yourdataitemtype)node.DataItem).YourPropertyOrWhatever.



yeah this same to what i did last time ,thanks for the help  




_________________
remote workforce | livechat operators