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

RadFileExplorer and open new window

4 Answers 184 Views
FileExplorer
This is a migrated thread and some comments may be shown as answers.
Stefano
Top achievements
Rank 1
Stefano asked on 12 Feb 2014, 05:02 PM
Hello
I have 2 problems with RadFileExplorer in thubnails view.

1)
My file are stored in a SQLServer database and i use a DBDataServer for retrive data and a handler.ashx for get the current context and response a bitestream to client.. ..but.. it is all correct for a 'normal' PC browser, using a iPad the file will be displayer over the current page and i dont want it !

I need a window.open (in a new page). I have tried all possibles internet solution but i dont have a correct solution.

2)
I nedd a custom FileList.ListView.ClientSettings.DataBinding.ItemTemplate to show other file information but never want to work.. see item.Description

//                var itemTemplate = @"<li class=""rfeThumbList rlvI"">
//                        <a href=""javascript:%open%;"" 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=""%default%"" alt=""#= Name #"" width=""32"" height=""32"" />
//                            # } else { #
//                                <span class=""rfeFileIcon #= Telerik.Web.UI.FileExplorerHelper.getThumbnailCSSExtension(item) #""></span>
//                            # } #
//                            </span>
//                            <span class=""rfeThumbTitle"">#= Name #</span>
//                        </a>      
//                        <span class=""rfeThumbTitle"">#= item.Description #</span>                  
//                    </li>";


THX

4 Answers, 1 is accepted

Sort by
0
Vessy
Telerik team
answered on 17 Feb 2014, 05:03 PM
Hello Stefano,

The first reported issue is a general limitation of the Response.Write() method, and it cannot be controlled by the FileExplorer control. In order to use the window.open() method, you can implement a similar logic in the ClientFileOpen event of the control:
<telerik:RadFileExplorer runat="server" ID="RadFileExplorer1" Height="500px" Width="600px" OnClientFileOpen="OnClientFileOpen">
</telerik:RadFileExplorer>
<script>
    function OnClientFileOpen(oExplorer, args) {
        args.set_cancel(true);
        window.open(args.get_item().get_url());
    }
</script>


Regarding the second issue - at present, RadFileExplorer does not offer functionality to modify the Thumbnail template but we are planning to introduce such feature in one of the upcoming releases.

For the time being, you can 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 use smaller (thumbnail) images instead of original ones:
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>";

Please note, that most probably you will need to extend the template in order to fit your custom requirements (e.g. to set the src to the created thumbnails).

Regards,
Veselina Raykova
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the UI for ASP.NET AJAX, subscribe to the blog feed now.
0
Stefano
Top achievements
Rank 1
answered on 20 Feb 2014, 08:46 AM
Very thx for your reply !
I have just tried your solutions and not works for my case :(

1- i have sqlserver embedded files. Windows opend want phisical files on file system and a correct file URL, so the first step is create a temp file unblobbing the data from sqlserver table and pass the phisical file path to window.open.. but
After the OnClientFileOpen event,  i have tried to call a custom web service for create the temp file, ok but after the ws synchronous resposne window.open do not work correctry because there is not a postback (??)
All my tentative to implement some other in OnClientFileOpen  filed because there is not a postback, all responses will be displayed alfter a page refresh... Oo

2- Thx. Can you explain me how i can expand the item properties ? ex Item.Description,  #= item.Description #,  #= Description # ??
For the grid view is all correct i have inserted some new colums and them works fine ! But for the thumbnails.. no..

THX


0
Stefano
Top achievements
Rank 1
answered on 20 Feb 2014, 08:49 AM
Sorry for my eng ^.^
filed  => fails
0
Vessy
Telerik team
answered on 25 Feb 2014, 07:52 AM
Hi Stefano,

In order to make RadFileExplorer work with a DataBase you will need to either implement your custom provider, or use the one provided by us in this code library: Connect RadFileExplorer or RadEditor to a SQL database. Indeed FileExplorer updates itself via Ajax, but if you use a Generic handler (like the one in the linked provider) you will be able to open the files through it.

Regarding your second question - it depends on the custom logic you are using to add description to the item. If you are adding the description directly to the image object, yes, it could be accessed like follows:
alt=""#= item.Description #""

More detailed information on how to design Client-side templates with RadListView is available here: Defining Client-Side HTML Templates

I hope this helps.

Regards,
Veselina Raykova
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the UI for ASP.NET AJAX, subscribe to the blog feed now.
Tags
FileExplorer
Asked by
Stefano
Top achievements
Rank 1
Answers by
Vessy
Telerik team
Stefano
Top achievements
Rank 1
Share this question
or