CHILDTYPE Attribute | ChildType Property

Sets or retrieves the type of TreeNodeType to use for all descendents.

Syntax

ASP <tagPrefix:ELEMENT CHILDTYPE = sChildType ... >
Script [ sChildType = ] object.ChildType

Possible Values

tagPrefix Required. The element prefix associated with the WebControls namespace (Microsoft.Web.UI.WebControls). A TagPrefix is defined using the directive.
sChildType System.String that specifies or receives the type of TreeNodeType to use for all children of a node of that type.

The property is read/write. The property has no default value.

Remarks

The value of ChildType must correspond to the value assigned to the Type property of a TreeNodeType element.

Examples

In this example, a TreeNodeType is defined whose Type is "State" and whose ImageUrl is "folder.gif".

All the child nodes of TreeView inherit through ChildType the node type "State" and display the "folder.gif" image next to the node text.

Therefore, the "Michigan" node inherits the type "State" from the TreeView element and the node displays "folder.gif". Its children, "Detroit", "Farmington", etc. also inherit the "State" node type and so use the "folder.gif" image.


<%@ import namespace="Microsoft.Web.UI.WebControls" %>
<%@ Register TagPrefix="mytree" 
Namespace="Microsoft.Web.UI.WebControls" 
Assembly="Microsoft.Web.UI.WebControls, Version=1.0.2.226, Culture=neutral, PublicKeyToken=31bf3856ad364e35" %>
<mytree:TREEVIEW runat="server" CHILDTYPE="State">
   <mytree:TREENODETYPE TYPE="State" 
                        IMAGEURL="images/folder.gif" />
   <mytree:TREENODE TEXT="Michigan">
      <mytree:TREENODE TEXT="Detroit" />
      <mytree:TREENODE TEXT="Farmington" />
      <mytree:TREENODE TEXT="Southfield" />
      <mytree:TREENODE TEXT="Traverse City" />
   </mytree:TREENODE>
   <mytree:TREENODE TEXT="Washington" >
      <mytree:TREENODE TEXT="Bellevue" />
      <mytree:TREENODE TEXT="Redmond" />
      <mytree:TREENODE TEXT="Woodenville" />
   </mytree:TREENODE>
</mytree:TREEVIEW>

In this example, which is built on the previous one, a second TreeNodeType is defined whose Type is "City" and whose ImageUrl is "document.gif". A ChildType of "City" has been added to the first TreeNodeType.

As in the previous example, all the child nodes of TreeView inherit through ChildType the node type "State" and display the "folder.gif" image next to the node text. However, the children of nodes whose type is "State" inherit through ChildType the node type "City" and display the "document.gif" image next to the node text.

Therefore, the "Michigan" and "Washington" nodes inherit the type "State" from the TreeView element and use "folder.gif", and their child nodes, "Detroit", "Bellevue", etc. inherit the "City" node type and, therefore, use "document.gif".


<%@ import namespace="Microsoft.Web.UI.WebControls" %>
<%@ Register TagPrefix="mytree" 
Namespace="Microsoft.Web.UI.WebControls" 
Assembly="Microsoft.Web.UI.WebControls, Version=1.0.2.226, Culture=neutral, PublicKeyToken=31bf3856ad364e35" %>
<mytree:TREEVIEW runat="server" CHILDTYPE="State">
   <mytree:TREENODETYPE TYPE="State" 
                        CHILDTYPE="City" 
                        IMAGEURL="images/folder.gif" />
   <mytree:TREENODETYPE TYPE="City" 
                        IMAGEURL="images/document.gif" />
   <mytree:TREENODE TEXT="Michigan">
      <mytree:TREENODE TEXT="Detroit" />
      <mytree:TREENODE TEXT="Farmington" />
      <mytree:TREENODE TEXT="Southfield" />
      <mytree:TREENODE TEXT="Traverse City" />
   </mytree:TREENODE>
   <mytree:TREENODE TEXT="Washington" >
      <mytree:TREENODE TEXT="Bellevue" />
      <mytree:TREENODE TEXT="Redmond" />
      <mytree:TREENODE TEXT="Woodenville" />
   </mytree:TREENODE>
</mytree:TREEVIEW>

Applies To

TreeBase, TREENODE, TREENODETYPE, TREEVIEW

See Also

Internet Explorer WebControls, About the TreeView WebControl