ASPxClientTreeViewNode.GetText Method

Gets the text, displayed within the node.

Declaration

GetText(): string

Returns

Type Description
string

A string value representing the text displayed within the node.

Remarks

Note

The GetText method is not in effect when you specify the TextTemplate for a node. Refer to the Q330439: ASPxTreeView - The ASPxClientTreeViewNode.GetText method does not return a node text if the node TextTemplate is implemented ticket for a workaround.

Examples

The code below lists checked nodes and shows them in a label on the client side.

<script type="text/javascript">
    function OnCheckedChanged(s, e) {
        label.SetText("Checked nodes:");
        ListCheckedNodes(s);
    }

    function ListCheckedNodes(parent){    
        for (var i=0; i < parent.GetNodeCount(); i++){
            if (parent.GetNode(i).GetChecked()){
               label.SetText(label.GetText() + " " + parent.GetNode(i).GetText());    
            }
            if (parent.GetNode(i).GetNodeCount() != 0){
               ListCheckedNodes(parent.GetNode(i));
            }
        }
    }
</script>
<dx:ASPxTreeView ID="ASPxTreeView1" runat="server" AllowCheckNodes="True" ClientInstanceName="treeview" DataSourceID="XmlDataSource1">
    <ClientSideEvents CheckedChanged="OnCheckedChanged" />
</dx:ASPxTreeView>
<br />
<dx:ASPxLabel ID="ASPxLabel1" runat="server" ClientInstanceName="label" Text="Checked nodes:">
</dx:ASPxLabel>
<asp:XmlDataSource ID="XmlDataSource1" runat="server" DataFile="~/App_Data/MenuTabbedMenu.xml" XPath="/mainmenu/item"></asp:XmlDataSource>
See Also