Skip to main content

FileManagerDetailsColumn.ItemTemplate Property

Gets or sets a common template used for displaying the content of all items within the current details view column.

Namespace: DevExpress.Web

Assembly: DevExpress.Web.v23.2.dll

NuGet Package: DevExpress.Web


public virtual ITemplate ItemTemplate { get; set; }

Property Value

Type Default Description
ITemplate null

An object supporting the ITemplate interface, which contains the template.


Use the ItemTemplate property to define a common content for all items displayed within the current details view column. The template created using this property replaces the content of each item, preserving its style settings (if specified).

You can specify an item template for thumbnails view mode using the FileManagerFileListThumbnailsViewSettings.ItemTemplate property.

Run Demo: File Manager - Templates


Once a template defined via the ItemTemplate property is created within a control, it is instantiated within a container object of the FileManagerDetailsViewItemTemplateContainer type. This container object exposes a set of specific properties to which the template’s child controls can be bound.

Example: A simple implementation of ItemTemplate for the Details View

Item Template

<dx:ASPxFileManager ID="ASPxFileManager1" runat="server">
    <Settings RootFolder="~\Root" ThumbnailFolder="~\Thumb\" InitialFolder="Images\Employees\" />
    <SettingsFileList View="Details" ShowFolders="true" ShowParentFolder="true">
        <DetailsViewSettings ThumbnailHeight="75" ThumbnailWidth="75">
                <dx:FileManagerDetailsColumn FileInfoType="Thumbnail" VisibleIndex="0"/>
                <dx:FileManagerDetailsColumn Caption="Name">
                        <dx:ASPxLabel runat="server" Text='<%# GetItemName(Container.Item) %>' />
                <dx:FileManagerDetailsColumn Caption="Type">
                        <dx:ASPxLabel runat="server" Text='<%# GetItemType(Container.Item) %>' />
                <dx:FileManagerDetailsColumn Caption="Size">
                        <dx:ASPxLabel runat="server" Text='<%# GetSize(Container.Item) %>' />
Dictionary<String, String> extensionsDisplayName;

Dictionary<String, String> ExtensionsDisplayName {
    get {
        if (extensionsDisplayName == null) {
            extensionsDisplayName = new Dictionary<String, String>();
            extensionsDisplayName.Add(".txt", "Text Document (.txt)");
            extensionsDisplayName.Add(".rtf", "Rich Text Document (.rtf)");
            extensionsDisplayName.Add(".xml", "XML File (.xml)");
            extensionsDisplayName.Add(".png", "PNG image (.png)");
            extensionsDisplayName.Add(".jpg", "JPEG image (.jpg)");
            extensionsDisplayName.Add(".mp3", "MPEG Layer 3 Audio File (.mp3)");
            extensionsDisplayName.Add(".avi", "AVI File (.avi)");
            extensionsDisplayName.Add(".zip", "Compressed (zipped) Folder (.zip)");
        return extensionsDisplayName;

public string GetItemName(FileManagerItem item) {
    if (item == null)
        return String.Empty;
    FileManagerFile file = item as FileManagerFile;
    if (file != null)
        return Path.GetFileNameWithoutExtension(file.RelativeName);
        return item.Name;
public string GetItemType(FileManagerItem item) {
    if (item == null) return String.Empty;
    FileManagerFile file = item as FileManagerFile;
    if (file != null) {
        if (ExtensionsDisplayName.ContainsKey(file.Extension))
            return ExtensionsDisplayName[file.Extension];
    else {
        return item.Name.Equals("..") ? String.Empty : "Folder";
    return String.Empty;

public string GetSize(FileManagerItem item) {
    if (item == null) return String.Empty;
    FileManagerFolder folder = item as FileManagerFolder;
    if (folder != null) {
        if (folder.Name.Equals(".."))
            return String.Empty;
            return string.Format("{0:f} Kb", CountFolderSize(folder) / 1024);
    return item.Length / 1024 + " Kb";

private float CountFolderSize(FileManagerFolder folder, float length = 0) {
    FileManagerFile[] files = folder.GetFiles();
    foreach (FileManagerFile file in files)
        length += file.Length;

    FileManagerFolder[] folders = folder.GetFolders();
    foreach (FileManagerFolder childFolder in folders)
        length = CountFolderSize(childFolder, length);
    return length;
See Also