This is a migrated thread and some comments may be shown as answers.

Replace icon in thumbnail view

3 Answers 67 Views
FileExplorer
This is a migrated thread and some comments may be shown as answers.
Cavit
Top achievements
Rank 1
Cavit asked on 02 Jul 2015, 12:29 PM

Hi, 

I want to show screenshot of Doc/Pdf files instead of the default icon on the file Explorer in Thumbnails View.

The screen shot is located on my machine and I have multiple files. So for every file, screenshot will be different.

Is there a way I can replace the default icon ?

Thanks

3 Answers, 1 is accepted

Sort by
0
Vessy
Telerik team
answered on 06 Jul 2015, 03:57 PM
Hi Cavit,

A possible approach you can use in order to achieve the target custom pdf-thumbnails functionality is to modify the template by replacing the current ItemTemplate of the control's underlying ListView. The following is the original template used by RadFileExplorer, you can modify it to add your own logic to use custom thumbnail images instead of original icon:
RadFileExplorer1.FileList.ListView.ClientSettings.DataBinding.ItemTemplate =
        @"<li class=""rfeThumbList rlvI"">
            <a href=""javascript: void 0;"" class=""rfeLink rlvDrag#= isSelected ? ' rfeSelectedLink' : ''#"" data-index=""#= index #"" title=""#= Name #"">
                <span class=""rfeFile#= Telerik.Web.UI.FileExplorerHelper.isWebImage(item.Extension) ? ' rfeImageFile' : '' #"">
                # if(Telerik.Web.UI.FileExplorerHelper.isWebImage(item.Extension)) {#
                    <img src=""#= item.Url || Path #"" alt=""#= Name #"" width=""32"" height=""32"" />
                # } else { #
                    <span class=""rfeFileIcon #= Telerik.Web.UI.FileExplorerHelper.getThumbnailCSSExtension(item) #""></span>
                # } #
                </span>
                <span class=""rfeThumbTitle"">#= Name #</span>
            </a>
        </li>";

For example, you can use a similar to the following implementation, defining separate case for the PDF files:
protected void Page_Load(object sender, EventArgs e)
{
    RadFileExplorer1.FileList.ListView.ClientSettings.DataBinding.ItemTemplate =
            @"<li class=""rfeThumbList rlvI"">
                <a href=""javascript: void 0;"" class=""rfeLink rlvDrag#= isSelected ? ' rfeSelectedLink' : ''#"" data-index=""#= index #"" title=""#= Name #"">
                    <span class=""rfeFile#= Telerik.Web.UI.FileExplorerHelper.isWebImage(item.Extension) ? ' rfeImageFile' : '' #"">
                    # if(Telerik.Web.UI.FileExplorerHelper.isWebImage(item.Extension)) {#
                        <img src=""#= item.Url || Path #"" alt=""#= Name #"" width=""32"" height=""32"" />
                    # } else if (item.Extension == "".pdf"") {#
                        <img src=""ThumbnailsPDF/#= Name.substring(0, Name.lastIndexOf("".""))#.jpg "" alt=""#= Name #"" width=""32"" height=""32"" />
                    # } else { #
                        <span class=""rfeFileIcon #= Telerik.Web.UI.FileExplorerHelper.getThumbnailCSSExtension(item) #""></span>
                    # } #
                    </span>
                    <span class=""rfeThumbTitle"">#= Name #</span>
                </a>
            </li>";
}

I hope this helps.

Regards,
Vessy
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Cavit
Top achievements
Rank 1
answered on 09 Jul 2015, 02:09 PM

Thanks. That helped me to solve my problem.

Regards

0
Vessy
Telerik team
answered on 10 Jul 2015, 10:18 AM
Hi Cavit,

I am glad the proposed solution is working for your scenario. Do not hesitate to reach us again should we can be of any further assistance.

Regards,
Vessy
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
FileExplorer
Asked by
Cavit
Top achievements
Rank 1
Answers by
Vessy
Telerik team
Cavit
Top achievements
Rank 1
Share this question
or