I need to get the text from a node's parent node from inside the InstantiateIn() sub, but I just can't seem to figure it out. Thanks in advance for your help.
Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.
Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.
Hi Christina:
You can go up from the current control to a node using the NamingContainer property. The count of steps is dependent on the template container that contains the control. Then you get the node, you can get its parent node using the ParentNode property of the TreeListNode.
If you need my help with it, please describe your controls hierarchy in greater detail and I'll prepare a sample for you.
Thanks
Kate.
Thanks for the quick reply Kate, but I'm having a lot of trouble casting the UI.Control to a TreeListNode. Here's what I'm doing:
Private Sub InstantiateIn(ByVal container As System.Web.UI.Control) Implements ITemplate.InstantiateIn
…
Dim n As TreeListNode = TryCast(container.NamingContainer, TreeListNode)
…
End Sub
I get the following error:
Value of type 'System.Web.UI.Control' cannot be converted to 'DevExpress.Web.ASPxTreeList.TreeListNode'.
Thanks again!
Hi Christina:
In this situation my previous solution is inapplicable, please accept my apologies for this inconvenience.
Another solution is to find a corresponding node using the NodeKey.
Here is a sample that illustrates this approach:
Private Sub InstantiateIn(ByVal container As System.Web.UI.Control) Implements ITemplate.InstantiateIn Dim con As TreeListDataCellTemplateContainer = TryCast(container, TreeListDataCellTemplateContainer) Dim tList As ASPxTreeList = con.TreeList Dim key As Object = con.NodeKey Dim node As TreeListNode = tList.FindNodeByKeyValue(key) End Sub
Thanks
Kate.
Thanks for all your help Kate! That worked like a charm.