|
Article relates to
|
RadFileExplorer for ASP.NET AJAX Q3 2009
|
|
Created by
|
Fiko, Telerik
|
|
Last modified
|
March 14, 2012
|
|
Last modified by
|
Pero, Telerik
|
HOW TO
This article describes the steps in order to show thumbnail previews inside the
RadGrid embedded in
RadFileExplorer control.
DESCRIPTION
The thumbnail images are shown in a custom column added to the Grid, embedded in
RadFileExplorer. More detailed description about adding a custom columns can be found in
this online demo.
SOLUTION
A custom FileBrowserContentProvider needs to be implemented in order to achieve the desired result. Only the behavior of the
ResolveDirectory method needs to be changed and the easiest way to do this is to subclass the default provider (
Telerik.Web.UI.Widgets.FileSystemContentProvider) and override that method only. In the overridden method, a HTML content (a <img> tag) needs to be added to the
Attributes collection of the image files only:
Please note that the attribute name (
Thumb in the demo) should mach the
UniqueName set to the added custom column.
The
scr attribute of the image should be set to the FileItem's Location property. A CSS class named
thumbImages is applied to the added
img element in order to control the appearance of the images. The CSS class needs to be placed on the page where the
RadFileExplorer control is declared
RESULT
Note:
The designed behavior of RadGrid is to suppress the standard RadGrid events for the following HTML elements: input, textarea, label, img, select, option, button. This is to avoid interfering with the functionality of the standard elements. This implies that double-clicking on the thumbnail will not open the preview dialog. To enable this functionality you need to override the following RadGrid functions: