Skip to main content
Tab

FileManagerFile.Extension Property

Gets the string that specifies the extension of the file.

Namespace: DevExpress.Web

Assembly: DevExpress.Web.v24.1.dll

NuGet Package: DevExpress.Web

Declaration

public string Extension { get; }

Property Value

Type Description
String

A String specifying a file extension, including the leading dot.

Example

In the example below, the CustomThumbnail event is handled to analyze file extensions and represent each file type using the corresponding custom thumbnail image.

public void ASPxFileManager1_CustomThumbnail(object source, DevExpress.Web.FileManagerThumbnailCreateEventArgs e) {
        switch(((FileManagerFile)e.Item).Extension) {
            case ".avi":
                e.ThumbnailImage.Url = "Images/movie.png";
                break;
            case ".zip":
                e.ThumbnailImage.Url = "Images/archive.png";
                break;
            case ".txt":
                e.ThumbnailImage.Url = "Images/txt.png";
                break;
            case ".rtf":
                e.ThumbnailImage.Url = "Images/richtxt.png";
                break;
            case ".mp3":
                e.ThumbnailImage.Url = "Images/music.png";
                break;
            case ".xml":
                e.ThumbnailImage.Url = "Images/code.png";
                break;
        }
}
See Also