RadFileExplorer and open new window

5 posts, 0 answers
  1. Stefano
    Stefano avatar
    6 posts
    Member since:
    Aug 2011

    Posted 12 Feb 2014 Link to this post

    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
  2. Vessy
    Admin
    Vessy avatar
    1389 posts

    Posted 17 Feb 2014 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Stefano
    Stefano avatar
    6 posts
    Member since:
    Aug 2011

    Posted 20 Feb 2014 Link to this post

    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


  5. Stefano
    Stefano avatar
    6 posts
    Member since:
    Aug 2011

    Posted 20 Feb 2014 in reply to Stefano Link to this post

    Sorry for my eng ^.^
    filed  => fails
  6. Vessy
    Admin
    Vessy avatar
    1389 posts

    Posted 25 Feb 2014 Link to this post

    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.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017