This documentation is archived and is not being maintained.

TreeView.ExpandImageUrl Property

Gets or sets the URL to a custom image for the expandable node indicator.

Namespace:  System.Web.UI.WebControls
Assembly:  System.Web (in System.Web.dll)

public string ExpandImageUrl { get; set; }
<asp:TreeView ExpandImageUrl="String" />

Property Value

Type: System.String
The URL to a custom image to display for expandable nodes. The default is an empty string (""), which displays the default plus sign (+) image.

Use the ExpandImageUrl property to specify a custom image for the expandable node indicator. This image is displayed next to an expandable node and is usually a plus sign (+).

When the ShowExpandCollapse property is set to true, the TreeView control displays a plus sign (+) or minus sign (-) or a placeholder image next to a node to indicate whether the node is expandable, collapsible, or non-expandable, respectively. You can specify custom images by first setting the ImageSet property to TreeViewImageSet.Custom, and then setting the NoExpandImageUrl, ExpandImageUrl, and CollapseImageUrl properties to the URLs for the custom images. If no images are specified, the default images are used. To hide the expansion node indicators, set the ShowExpandCollapse property to false.


To ensure that nodes align correctly in the TreeView control when using custom images, make sure that all the images that are specified by the NoExpandImageUrl, ExpandImageUrl, and CollapseImageUrl properties have the same dimensions.

To display a custom image correctly, you might have to set ShowLines to false.

When using a custom image for the expandable node indicator, you should also consider setting the ExpandImageToolTip property to specify a ToolTip for the image.

The value of this property is stored in view state.

The following code example demonstrates how to use the ExpandImageUrl property to specify a custom image for the expandable node indicator. For the code example to display and the image to appear in the control, you must provide your own image and the ImageSet property must be set to TreeNodeImageSet.Custom.

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

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
<html xmlns="" >
  <head runat="server">
    <title>TreeView Custom Images Example</title>
    <form id="form1" runat="server">

      <h3>TreeView Custom Images Example</h3>

      <!-- Set the custom images of this TreeView control -->
      <!-- declaratively.                                 -->
      <asp:TreeView id="CustomTreeView"
        CollapseImageToolTip="Collapse Node"
        ExpandImageToolTip="Expand Node"


          <asp:TreeNode Value="Home" 

            <asp:TreeNode Value="Page 1" 
              Text="Page 1"

              <asp:TreeNode Value="Section 1"
                Text="Section 1"


            <asp:TreeNode Value="Page 2" 
              Text="Page 2"





Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.5, 3.0, 2.0