aspnet-devexpress-dot-web-dot-filemanagerfile-4ef7aa56.md
Gets the string that specifies the extension of the file.
Namespace : DevExpress.Web
Assembly : DevExpress.Web.v25.2.dll
NuGet Package : DevExpress.Web
public string Extension { get; }
Public ReadOnly Property Extension As String
| Type | Description |
|---|---|
| String |
A String specifying a file extension, including the leading dot.
|
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;
}
}
<dx:ASPxFileManager ID="ASPxFileManager1" runat="server" OnCustomThumbnail="ASPxFileManager1_CustomThumbnail">
<Settings RootFolder="~/Content/FileManager/Files" ThumbnailFolder="~/Content/FileManager/Thumbnails"
AllowedFileExtensions=".jpg,.rtf,.txt,.avi,.png,.mp3,.xml" InitialFolder="Documents" />
<SettingsUpload Enabled="false"></SettingsUpload>
</dx:ASPxFileManager>
See Also
FileManagerSettings.AllowedFileExtensions