This demo describes how you can manipulate the DevExpress MVC TreeView programmatically on the client, using extended client-side functionality.
The client-side programmatic interface is available if the EnableClientSideAPI property is set to true or if there is a handler assigned to any client-side event. Once set, an individual client control object can be referenced directly by its Name. In the demo, the MVC TreeView's client-side API is used to do the following:
- Toggle the visibility of the TreeView via the SetVisible client method.
- Synchronize the currently selected TreeView node with the combo box, providing a list of nodes via the TreeView's NodeClick client event handler.
- Display node properties and synchronize them with corresponding options displayed within the right-hand panel. Nodes are identified using names assigned via the corresponding property. A node's client object is accessed via the TreeView's GetNodeByName client method. To change a TreeView's node state, the TreeView's SetSelectedNode option values in response to expanded and checked state changes via the TreeView's ExpandedChanged and CheckedChanged client event handlers. client method and the node's SetEnabled, SetVisible, SetChecked, or SetExpanded client methods are used.
- Update option values in response to expanded and checked state changes via the TreeView's ExpandedChanged and CheckedChanged client event handlers.
Local Copy of this Demo To inspect the source code for this demo on your machine, you must first install our components via the DevExpress Component Installer. |
You can open a local copy of this online demo directly from this webpage (if using v20.2.8, 21.1.4 or higher).
\Users\Public\Documents\DevExpress Demos XX.X\Components\ASP.NET\CS\MVCxNavigationAndLayoutDemos |