SELECTEDNODEINDEX Attribute | SelectedNodeIndex Property

Sets or retrieves the index of the selected node.

Syntax

ASP <tagPrefix:TREEVIEW SELECTEDNODEINDEX = sSelectedNodeIndex ... >
Script [ sSelectedNodeIndex = ] TREEVIEW.SelectedNodeIndex

Possible Values

tagPrefix Required. The element prefix associated with the WebControls namespace (Microsoft.Web.UI.WebControls). A TagPrefix is defined using the directive.
sSelectedNodeIndex System.String that specifies or receives the index of the selected node.
0Default. The index of the top-level node in the tree.

The property is read/write. The property has a default value of 0.

Remarks

To retrieve the TreeNode object, pass this index to the GetNodeFromIndex method.

The structure of the index returned by this mehtod is a concatenation of the ordinal number of the parent node at each level counting through the tree from 0 to the selected node and delimiting each level with a dot (.). The upper-most node in the top level of the tree is 0; the second node is 1, and so on. The node that immediately follows the first top-level node is 0.0; the second is 0.1, and so on. For example, for the index value 1.3.2, 1 is the second node at the top level of the tree; 3 is the fourth node under node 1; and 2 is the third node under node 1.3 and it is the selected node.

An exception is thrown if the index is invalid or is set to a non-visible TreeNode index.

Applies To

TREEVIEW

See Also

Internet Explorer WebControls, About the TreeView WebControl