asp.net.ph

TreeView.NodeStyle Property

System.Web.UI.WebControls Namespace   TreeView Class


.NET Framework version 2.0

Sets or retrieves the default style properties for the nodes in a TreeView control.

Syntax


Script TreeView.NodeStyle.Property [ = enumValue ]

Property Value

A TreeNodeStyle object that defines the default style properties for the nodes in a TreeView.

Remarks

Use the NodeStyle property to specify the default appearance of a node in a TreeView control. Common style attributes that can be set include forecolor, backcolor, font, and content alignment within the tree. Providing different node styles enhances the appearance of the TreeView control.

The NodeStyle subproperties can be set declaratively using either of the following methods:

  • Include an attribute in the opening tag of the TreeView control in the form NodeStyle-Property
    <asp:treeview ... 
       nodestyle-property=value
       ... >
    
    </asp:treeview>
  • Include a <NodeStyle> element between the opening and closing tags of the TreeView control
    <asp:treeview ... >
    
       <nodestyle
          ... property definitions here />
    
    </asp:treeview>

The subproperties can also be set programmatically in the form NodeStyle.Property.

Style properties are applied in the following order of precedence:

NOTE: The corresponding node style settings in the RootNodeStyle, ParentNodeStyle, or LeafNodeStyle properties override the style settings of the NodeStyle property.

If you need to generate table of contents-style navigation menus where nodes at a certain level should have the same appearance, regardless of whether they have child nodes, you might consider using the LevelStyles property instead of setting the individual style properties.

For a list of style properties that can be set, see the TreeNodeStyle class.

See Also

TreeView Members Skip Navigation Links




Home
Suggested Reading


Previous page Back to top Next page

© 2000-2010 Rey Nuñez All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note

You can help support asp.net.ph