Remove folder icon from Filelist.ascx treeview


Is there an easy way to remove the folder icon in treeview? It looks like it gets created into a <td> node in a table and uses this image: <img src="/App_Themes/Default/Images/ExplorerTree/FileTree/Folder.gif" alt="" style="border-width:0;" />

I want to remove the image and not have the <td> node in the table for the icon. Is that possible? Or would I have to create a custom treeview control and do it myself?

Aug 02, 2011 14:15

The easist way to remove the icons is with a little CSS. If you want to change the way FileTree renders I would consider using Control Adapters for this.

Take a look at this article for more information:, I also recommend taking a look at the CSS Adapter project for some good example on how this is done.

Hope this helps.


Aug 02, 2011 22:52

Thanks Frederik! I appreciate the advice. I didn't know about Control Adapters, this is definitely something I can use if I want to render the table differently. I'll take a look and see what I can do with the FileTree. I actually found another way to handle my problem.

After digging a little, I did find that you can remove the whole column all together by removing the ImageUrlField property from TreeNodeBinding.

<asp:TreeNodeBinding TextField="Name" ToolTipField="Title" ImageUrlField="ImageUrl" PopulateOnDemand="true" />

But it also removed the document icon (pdf, excel, word, etc.) and that's not what I wanted. So, I found that instead of removing that column all together, I could replace the icon with another image. I added the event OnResolveDirectoryImageUrl and replaced the image in the event. This seemed to work better for me.

<EPiServer:FileSystemDataSource ID="FileDataSource" OnResolveDirectoryImageUrl="FileDataSource_OnResolveDirectoryImageUrl" IncludeRoot="true" runat="server" />
protected void FileDataSource_OnResolveDirectoryImageUrl(object sender, ResolveDirectoryImageArgs e)
            string iconURL = HttpContext.Current.Request.Url.Scheme.ToString() + "://" + HttpContext.Current.Request.Url.Host.ToString() + "/Global/images/bullet_doublearrow.gif";
            if (iconURL != null || iconURL != "") { e.ImageUrl = iconURL; }
Aug 03, 2011 13:50

Also to add a little more control over whether I want to still use the original styling with the folder icon, I added a Selected/Not Selected Propety of "Apply New Style", and I check to see if it is checked (True). If it is True, then apply my new style and replace the folder icon with my icon.

Aug 03, 2011 13:55
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.