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

Size windows file pdf

5 Answers 315 Views
FileExplorer
This is a migrated thread and some comments may be shown as answers.
sdf
Top achievements
Rank 1
sdf asked on 01 Jun 2010, 02:36 PM
Hello everybody,

I am very novice in ASP.NET and telerik and i want to know if it's possible to have a big windows when i click on pdf files in radfileexplorer. (because now window are very small when i open files)
How can I do this ? 
I work in asp.net C# and i just use for the moment :

<telerik:Rafileexplorer ID="RadFileEplorer1" Runat="server" width="100%">  
</telerik:Rafileexplorer >

thx


Sorry for my bad english but i'm french ...

5 Answers, 1 is accepted

Sort by
0
Dobromir
Telerik team
answered on 03 Jun 2010, 04:06 PM
Hi,

Please find a complete tutorial on how to modify the behavior of the default dialogs of RadFileExplorer in the following KB article:
Change the behaviors of the embedded dialogs

Also, if you want to disable the RadWindow popups and open the files using default browser windows you can use the following sample code:
<telerik:RadFileExplorer ID="RadFileExplorer1" runat="server" OnClientFileOpen="OnClientFileOpen">
</telerik:RadFileExplorer>
 
<script type="text/javascript">
    function OnClientFileOpen(oExplorer, args)
    {
        //get the extension of the opened item
        var fileExt = args.get_item().get_extension();
        if (fileExt && fileExt.toLowerCase() == "pdf")
        {
            //cancel the default behavior
            args.set_cancel(true);
            //open new RadWindow
            var oWnd = radopen(args.get_item().get_path(), "RadWindow1");
            //set size to the newly opened RadWindow
            oWnd.setSize(600, 400);
            //if you want to open the PDF file in a new browser window
            //you can use the following code
            //window.open(args.get_item().get_path());
        }
    }
</script>

I hope this helps

Sincerely yours,
Dobromir
the Telerik team

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 Public Issue Tracking system and vote to affect the priority of the items.
0
David
Top achievements
Rank 1
answered on 05 Jul 2010, 01:52 PM
Thanks, It helped me a lot.
0
Marc
Top achievements
Rank 1
answered on 16 Jul 2010, 06:51 PM
I have just implemented your suggestion posted here with the JS.  While it works fine in Chrome, in IE8 the RadWindow opens with the PDF, then a new IE window opens with the PDF but then focus is taken back to the window with the RadWindow in it.  The user then must click back to the IE window with the PDF.

All I want is to not use the RadWindow at all for opening files from the FileExplorer.  Your solution is close, but not ideal in IE.
0
Petio Petkov
Telerik team
answered on 20 Jul 2010, 04:17 PM
Hello Marc,

In case that you don't want to use the RadWindow control, you can check whether the current file is directory or not, and use the window.open method to open the current file. E.g.
ASPX:
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<head id="Head1" runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
  
    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    <div>
    <telerik:RadFileExplorer ID="RadFileExplorer1" runat="server" OnClientFileOpen="OnClientFileOpen">
        <Configuration ViewPaths="~/Files" />
    </telerik:RadFileExplorer>
    <script type="text/javascript">
        function OnClientFileOpen(oExplorer, args)
        {
                var isDirectory = args.get_item().isDirectory();
  
                if (!isDirectory)
                {
                    //cancel the default behavior - RadWindow will not show
                    args.set_cancel(true);
                    var itemPath = args.get_item().get_path();
  
                    //if you want to open the PDF file in a new browser window
                    //you can use the following code
                    window.open(itemPath);
                }
        }
    </script>
    </div>
    </form>
</body>
</html>
Hope this helps.


Sincerely yours,
Petio Petkov
the Telerik team
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 Public Issue Tracking system and vote to affect the priority of the items
0
Marc
Top achievements
Rank 1
answered on 02 Aug 2010, 07:13 PM
That worked, thanks!
Tags
FileExplorer
Asked by
sdf
Top achievements
Rank 1
Answers by
Dobromir
Telerik team
David
Top achievements
Rank 1
Marc
Top achievements
Rank 1
Petio Petkov
Telerik team
Share this question
or