Tuesday, August 30, 2011

ASPxFileManager - How to Create Custom Thumbnails Icons for Files


To show your custom thumbnail icons in the ASPxFileManager Control, just use its CustomThumbnail
Event to specify your custom image file.

There you will get the file extension using the e.File.Extension property to set your image
using the  e.ThumbnailImage.Url property according to your file type.
  
public void fileManager1_CustomThumbnail(object sender, FileManagerThumbnailCreateEventArgs e)
        {
            switch (e.File.Extension)
            {
                case ".avi":
                    e.ThumbnailImage.Url = "Images/movie.png";
                    break;
                case ".txt":
                    e.ThumbnailImage.Url = "Images/txt.png";
                    break;
                case ".mp3":
                    e.ThumbnailImage.Url = "Images/music.png";
                    break;
                case ".xml":
                    e.ThumbnailImage.Url = "Images/code.png";
                    break;
            }
        }

No comments :

Post a Comment