Ticket Q330439
Visible to All Users

ASPxTreeView - The ASPxClientTreeViewNode.GetText method does not return a node text if the node TextTemplate is implemented

created 14 years ago

Hi,
   here is my simple code :
<dx:ASPxTreeView ID="treeView" runat="server" >
    <ClientSideEvents NodeClick="function(s,e){ alert( e.node.name + '_' + e.node.GetText()); }" />
        <Nodes>
            <dx:TreeViewNode Text="ASP.NET AJAX Controls" Name="Ajax">
                <TextTemplate>
                      <%# Eval("Text")%>
                </TextTemplate>
             </dx:TreeViewNode>
        </Nodes>
     </dx:ASPxTreeView>

the question is why the node's GetText() return empty? is that a bug?

Answers

created 14 years ago

Hello James,
Thank you for your question.
When you create the TextTemplate, a node text html element is not rendered. You are fully responsive for the displayed text in this case. On the other hand, you can create any template that helps you obtain a note text. For example, you can modify your sample in the following manner:

ASPx
<dx:ASPxTreeView ID="treeView" runat="server"> <ClientSideEvents NodeClick="function(s,e){ alert( e.node.name + '_' + document.getElementById('div_' + e.node.name).innerHTML); }" /> <Nodes> <dx:TreeViewNode Text="ASP.NET AJAX Controls" Name="Ajax"> <TextTemplate> <div id="div_<%# Eval("Name") %>"><%# Eval("Text")%></div> </TextTemplate> </dx:TreeViewNode> </Nodes> </dx:ASPxTreeView>

Let us know whether or not this information suits your needs.
Best regards,
Vladimir

    Comments (1)

      Thank you Vladimir. that's good advice.

      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.