TreeView.ImageSet Property

Definition

Gets or sets the group of images to use for the TreeView control.

public:
 property System::Web::UI::WebControls::TreeViewImageSet ImageSet { System::Web::UI::WebControls::TreeViewImageSet get(); void set(System::Web::UI::WebControls::TreeViewImageSet value); };
public System.Web.UI.WebControls.TreeViewImageSet ImageSet { get; set; }
member this.ImageSet : System.Web.UI.WebControls.TreeViewImageSet with get, set
Public Property ImageSet As TreeViewImageSet

Property Value

One of the TreeViewImageSet values. The default is TreeViewImageSet.Custom.

Exceptions

The specified image set is not one of the TreeViewImageSet values.

Examples

The following code example demonstrates how to use the ImageSet property to display the Windows Explorer set of images in the TreeView control.


<%@ Page Language="C#" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
  <head runat="server">
    <title>TreeView ImageSet Example</title>
</head>
<body>
    <form id="form1" runat="server">
    
      <h3>TreeView ImageSet Example</h3>
    
      <asp:TreeView id="LinksTreeView"
         ImageSet="XPFileExplorer" 
         runat="server">
         
        <Nodes>
        
          <asp:TreeNode Value="Home" 
            NavigateUrl="Home.aspx" 
            Text="Home"
            Target="_blank" 
            Expanded="True">
             
            <asp:TreeNode Value="Page 1" 
              NavigateUrl="Page1.aspx" 
              Text="Page1"
              Target="_blank">
               
              <asp:TreeNode Value="Section 1" 
                NavigateUrl="Section1.aspx" 
                Text="Section 1"
                Target="_blank"/>
                 
            </asp:TreeNode>              
            
            <asp:TreeNode Value="Page 2" 
              NavigateUrl="Page2.aspx"
              Text="Page 2"
              Target="_blank">
               
            </asp:TreeNode> 
            
          </asp:TreeNode>
        
        </Nodes>
        
      </asp:TreeView>

    </form>
  </body>
</html>

<%@ Page Language="VB" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
  <head runat="server">
    <title>TreeView ImageSet Example</title>
</head>
<body>
    <form id="form1" runat="server">
    
      <h3>TreeView ImageSet Example</h3>
    
      <asp:TreeView id="LinksTreeView"
         ImageSet="XPFileExplorer" 
         runat="server">
         
        <Nodes>
        
          <asp:TreeNode Value="Home" 
            NavigateUrl="Home.aspx" 
            Text="Home"
            Target="_blank" 
            Expanded="True">
             
            <asp:TreeNode Value="Page 1" 
              NavigateUrl="Page1.aspx" 
              Text="Page1"
              Target="_blank">
               
              <asp:TreeNode Value="Section 1" 
                NavigateUrl="Section1.aspx" 
                Text="Section 1"
                Target="_blank"/>
                 
            </asp:TreeNode>              
            
            <asp:TreeNode Value="Page 2" 
              NavigateUrl="Page2.aspx"
              Text="Page 2"
              Target="_blank">
               
            </asp:TreeNode> 
            
          </asp:TreeNode>
        
        </Nodes>
        
      </asp:TreeView>

    </form>
  </body>
</html>

Remarks

Use the ImageSet property to specify the group of images to use for the TreeView control. You can either select a predefined set of images to give the control a standard look or define your own custom set.

Note

The ImageSet property does not affect any style settings for a node. Set the appropriate style property, such as the NodeStyle property, if you want to add custom colors and spacing.

The following table lists the valid values for The ImageSet property.

Image set Description
TreeViewImageSet.Arrows A predefined image set that uses arrow images.
TreeViewImageSet.BulletedList A predefined image set that uses diamond-shaped bullet images.
TreeViewImageSet.BulletedList2 A predefined image set that uses square-shaped bullet images.
TreeViewImageSet.BulletedList3 A predefined set of sectioned, diamond shaped bullet images.
TreeViewImageSet.BulletedList4 A predefined set of alternate sectioned, diamond shaped bullet images in sizes that vary by level.
TreeViewImageSet.Contacts A predefined image set that uses MSN Messenger images.
TreeViewImageSet.Custom A user-defined image set.
TreeViewImageSet.Events A predefined image set that uses event log-styled images.
TreeViewImageSet.Faq A predefined image set that uses FAQ-styled images.
TreeViewImageSet.Inbox A predefined image set that uses email-styled images.
TreeViewImageSet.News A predefined image set that uses newsgroup-styled images.
TreeViewImageSet.Simple A predefined image set that uses simple shape outlines.
TreeViewImageSet.Simple2 A predefined image set that uses simple filled shapes.
TreeViewImageSet.Msdn A predefined image set that uses MSDN images.
TreeViewImageSet.WindowsHelp A predefined image set that uses Microsoft Windows Help images.
TreeViewImageSet.XPFileExplorer A predefined image set that uses Windows Explorer images available in Microsoft Windows XP.

When defining a custom set of images, you should specify an image for each of the properties in the following table. Otherwise, the default image for that property is used.

Property Description
CollapseImageUrl The URL to a custom image for the collapsible node indicator.
ExpandImageUrl The URL to a custom image for the expandable node indicator.
LineImagesFolder The URL to a folder that contains custom images for the lines that connect nodes.
NoExpandImageUrl The URL to a custom image for the non-expandable node indicator.

The value of this property is stored in view state.

Applies to

See also