Change size and attributes of popup file window

8 posts, 2 answers
  1. Steve Y
    Steve Y avatar
    115 posts
    Member since:
    Sep 2008

    Posted 17 Mar 2009 Link to this post

    I want to change the initial size of the popup window used on double click of a file and also make the window resizable. Currently the window is very small which is ok for images I guess, but I want to open pdf files etc and they are far too small for that purpose.

    Thanks in advance, Steve
  2. Answer
    Svetlina Anati
    Admin
    Svetlina Anati avatar
    2795 posts

    Posted 18 Mar 2009 Link to this post

    Hello Steve,

    One possible solution is to catch the OnClientLoad event and execute the following script in the handler:

     function OnClientLoad(sender, args)  
           {  
             var wndMng = sender.get_windowManager();  
             wndMng.set_width(800);//set desired width  
             wndMng.set_height(800);//set desired height  
     
           } 


    Best wishes,
    Svetlina
    the Telerik team


    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  3. Steve Y
    Steve Y avatar
    115 posts
    Member since:
    Sep 2008

    Posted 18 Mar 2009 Link to this post

    Svetlina,

    Thanks for the code - it works for me. Now the only thing left is to be able to change the attribute of the popup window to allow resize. Can you point me in the right direction please. I cannot see how to do it with the window manager and when I checked the window manager within the OnClientLoad function, the window had not been created yet so I could not change the window itself.

    Thanks, Steve
  4. Answer
    Tervel
    Admin
    Tervel avatar
    1337 posts

    Posted 23 Mar 2009 Link to this post

    Hi Steve Y,

    You can do so by calling the set_behaviors client method and specifying which behaviors you want enabled, e.g

          wndMng.set_behaviors(Telerik.Web.UI.WindowBehaviors.Resize + Telerik.Web.UI.WindowBehaviors.Move + Telerik.Web.UI.WindowBehaviors.Close);

    Greetings,
    Tervel
    the Telerik team

    Check out Telerik Trainer , the state of the art learning tool for Telerik products.
  5. Steve Y
    Steve Y avatar
    115 posts
    Member since:
    Sep 2008

    Posted 23 Mar 2009 Link to this post

    Hi Tervel ,

    Thanks - it's now doing exactly what I was want.

    I have one other issue I'm now seeing. I have a FileExplorer on a page the header of the control starts close to the bottom of my window. The directories and files appear below the bottom of my screen and so I scroll the window up so that the header, directories and  files are now central on my screen. If I select a file (single click) the page scrolls back down until it's scrolled to the top of the page.

    The result of this behavior is that I can not double click on a filename to open it if the page is scrolled down to that filename. This is because on the first click the page scrolls and the second click clicks on a different filename !

    Thanks for looking into this serious useability issue for me.

    Regards, Steve
  6. Tervel
    Admin
    Tervel avatar
    1337 posts

    Posted 25 Mar 2009 Link to this post

    Hi Steve Y,

    A couple of people already reported this and we are working on a fix. The fix should be integrated in the coming Q1 2009 Service Pack 1 scheduled for next week. The aim of the SP is proper IE8  support of Telerik RadControls suite.

    All the best,
    Tervel
    the Telerik team

    Check out Telerik Trainer , the state of the art learning tool for Telerik products.
  7. Trevor
    Trevor avatar
    18 posts
    Member since:
    Mar 2009

    Posted 27 Apr 2009 Link to this post

    I have an issue with the fileexplorer. It seems to work great and the files that i list are word documents.
    When a user double clicks on a file it opens up the file in microsoft word... Thats great and that works for me. Unfortunately when
    the user closes the file they are left looking at a popup screen with a title named the same as the file name.
    How can I eliminate this popup file?

    Trevor
  8. Lini
    Admin
    Lini avatar
    2144 posts

    Posted 28 Apr 2009 Link to this post

    Hi Trevor,

    The default FileExplorer behavior is to open a new window for each file you double click and set the address of this new window to the file url. In your case the browser sees that the address is a Word document and the popup window is left empty. If you want to prevent this from happening, you need to handle Word files separately with a few lines of JavaScript and prevent the FileExplorer from opening an additional window. Here is an example:

    <script type="text/javascript">  
    function fileOpen(sender, args)  
    {  
        var item = args.get_item();  
        if (item && !item.isDirectory() && (item.get_extension() == "docx" || item.get_extension() == "doc"))  
        {  
            //file is a MS Word document, do not open a new window.  
            args.set_cancel(true);  
            //tell browser to open file directly  
            window.location.href = item.get_url();  
        }  
    }  
    </script>  
    <telerik:RadFileExplorer runat="server" ID="RadFileExplorer1" OnClientFileOpen="fileOpen" ...>  
     


    Kind regards,
    Lini
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
Back to Top