ASPxClientTreeView.GetSelectedNode Method
Returns the selected node within the ASPxTreeView control on the client side.
Declaration
GetSelectedNode(): ASPxClientTreeViewNode
Returns
Type | Description |
---|---|
ASPxClientTreeViewNode | An ASPxClientTreeViewNode object that represents the selected node. |
Remarks
If the ASPxTreeView.AllowSelectNode property is set to true
, end-users are allowed to select nodes via mouse clicks. The selected node can be obtained on the client side by using the GetSelectedNode method. If there isn’t a selected node within a ASPxTreeView or selection is prohibited, the GetSelectedNode method returns null. In order to select a specific node on the client side, use the ASPxTreeView’s ASPxClientTreeView.SetSelectedNode method.
To learn more see the Selection topic.
Example
The code example below shows how you can change a node’s text on the client side.
<dx:aspxtreeview id="ASPxTreeView1" runat="server" allowselectnode="True" clientinstancename="treeview" DataSourceID="XmlDataSource1">
</dx:aspxtreeview>
<dx:aspxtextbox id="ASPxTextBox1" runat="server" clientinstancename="textbox" width="170px"></dx:aspxtextbox>
<dx:aspxbutton id="ASPxButton1" runat="server" text="Rename Node" AutoPostBack="False">
<ClientSideEvents Click="function(s, e) {treeview.GetSelectedNode().SetText(textbox.GetText());}"></ClientSideEvents>
</dx:aspxbutton>
See Also