tags:

views:

90

answers:

1

For the extra level of customization we are doing on our website we have manipulated the DNN Nodes Collection to remove certain nodes for certain people. Now we need to reverse this process and need to add nodes if conditions are right for the user.

I have tried this

Dim newNode As New DotNetNuke.UI.WebControls.DNNNode
newNode.NavigateURL = NavigateURL(12)
newNode.Text = "test"
newNode.ID = "x3"

then

objNodes.Add(newNode)

'objNodes' is the main node collection - I think i need to create a collection and add it to the child of a specific node but not sure how.

+1  A: 

It should be as simple as the following...

Dim newChildNode as New DotNetNuke.UI.WebControls.DNNNode()
With newChildNode
    .ID = "x4"
    .Text = "Text"
    .NavigateURL = NavigateURL(4)
End With

newNode.DNNNodes.Add(newChildNode)
Oliver Hine
Thanks Oliver but I am not getting the new node to show in my menu -I am doing this in the bind for my menu provider - am i missing something you think?
codemypantsoff
Looking at my custom menu provider, the only thing that's missing from this example is "Me.Bind(objNodes)" after the collection is complete
Oliver Hine
Okay it was some other custom code that was blocking it - one more thing Oliver is if i loop using this i only get the first object added to the node so for example i wrap a for x as integer = 0 to 3 around this i should get 4 items added - i only get one
codemypantsoff