ASPxClientTreeView.CheckedChanged Event

Occurs on the client side when the node’s checked state is changed by clicking on a check box.

Declaration

CheckedChanged: ASPxClientEvent<ASPxClientTreeViewNodeProcessingModeEventHandler<ASPxClientTreeView>>

Event Data

The CheckedChanged event's data class is ASPxClientTreeViewNodeProcessingModeEventArgs. The following properties provide information specific to this event:

Property Description
node Gets a node object related to the event.
processOnServer Specifies whether or not to process the event on the server. Inherited from ASPxClientProcessingModeEventArgs.

Remarks

Write a handler for the CheckedChanged event, to perform any custom actions on the client side in response to the node’s checked state being changed.

Note

The CheckedChanged event fires after a user has changed the checked state by clicking on a check box. If you change the checked state programmatically or it changes automatically (when the ASPxTreeView.CheckNodesRecursive property is set to true) the event is not invoked.

Example

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

View Example

<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