Display Loading image

8 posts, 0 answers
  1. Orest
    Orest avatar
    31 posts
    Member since:
    Apr 2009

    Posted 01 Dec 2009 Link to this post

    Guys,

    I have 2 radwindows that are controlled buy WindowManager. Both of them host the same user control. In the first scenario control will generate some HTML and assigned it to a label.text. In a second scenario I will use Response.BinaryWrite to write pdf document to a response stream. I use DestroyOnClose="true” to make sure I have a clean load every time. So far so good, the only one thing that I can not figure out is how to do I show “Loading” image. I cannot do “ShowContentDuringLoad="false"” because the content for a window that is writing to response will never come up. This is also in your documentation (Note: If you intend to show a PDF file in RadWindow instead of a standard page, make sure that ShowContentDuringLoad is set to true. Otherwise if the loaded content is not a page, window.onload will not be fired and RadWindow will not show the content.)

    So what can I do?  I really need to make this work because it might take up to 10 seconds while those windows are fully loaded.

    <telerik:RadWindowManager ID="RadWindowManager1" runat="server"   
    Skin="Web20"   
    VisibleStatusbar="false" IconUrl=" " Height="860px" Width="750px" Modal="true" Behaviors="Close,Move,Resize" 
    DestroyOnClose="true"   > 
        <Windows> 
            <telerik:RadWindow ID="radPreview" runat="server" Title="Preview" ></telerik:RadWindow> 
            <telerik:RadWindow ID="radPreviewPdf" runat="server" Title="PDF Preview"></telerik:RadWindow> 
     
        </Windows> 
    </telerik:RadWindowManager> 

    and I open an window with
            function launchPreview(type) {  
     
                url = "blablbla.aspx?bla=sds";  
                if (type == 'pdf') {  
                    url = url + "&show=pdf" 
                    var oWnd = window.radopen(url, "radPreviewPdf");  
                    oWnd.set_title("PDF Preview");  
                    oWnd.set_showContentDuringLoad(true);  
                    return;  
                } else {              
                    var oWnd = window.radopen(url, "radPreview");  
                    oWnd.set_title("HTML Preview");                                   
                }  
            } 
  2. Georgi Tunev
    Admin
    Georgi Tunev avatar
    7207 posts

    Posted 02 Dec 2009 Link to this post

    Hello Orest,

    I believe that the following forum thread will be of help:
    http://www.telerik.com/community/forums/aspnet/window/radwindow-never-stops-quot-loading-quot.aspx



    Regards,
    Georgi Tunev
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Orest
    Orest avatar
    31 posts
    Member since:
    Apr 2009

    Posted 02 Dec 2009 Link to this post

    Thank you Georgi.
    I think using your code will work for me. As you suggested I added "Loading" image to a Blank.aspx so it works great for all request other then first.  So my question is how do we initially find and set window url to Blank.aspx so when we initially open this window it showing Blank.aspx

    function OnClientClose(sender)  
        {  
            sender.setUrl("Blank.aspx");   
        } 
  5. Georgi Tunev
    Admin
    Georgi Tunev avatar
    7207 posts

    Posted 03 Dec 2009 Link to this post

    Hi Orest,

    I would suggest the following:
    1. Set DestroyOnClose to false - since you are changing the URL in OnClientClose, you will get the "Loading" page anyway, so there is no need to destroy the object.
    2. Set the NavigateUrl property of the window in which you will show the PDF to the "Loading" page.
    3. open the RadWindow - this way you will get the "loading" page displayed.
    4. In OnClientPageLoad (you can use add_pageLoad() to set it dynamically) use setUrl() to point to the PDF. When the PDF is loaded, OnClientPageLoad will not be fired again because the PDF document does not throw onload event.
    I hope that this approach will help. If you still experience problems, please open a support ticket and send me a small sample project where I can examine your exact setup and logic in more details.

    Kind regards,
    Georgi Tunev
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  6. Orest
    Orest avatar
    31 posts
    Member since:
    Apr 2009

    Posted 11 Dec 2009 Link to this post

    Sorry Georgi,
    I guess I'm missing something here. Everything is working other then Initial call. It works because per your suggestion

    OnClientClose i do  sender.setUrl("Blank.aspx");  How do I make it work for initial call.  I added NavigateUrl to  a window definition but its not helping.

     

    <telerik:RadWindowManager ID="RadWindowManager1" runat="server"   
    ReloadOnShow="True" KeepInScreenBounds="true"   
    VisibleStatusbar="false" IconUrl=" " Height="860px" Width="750px"   
    OnClientClose="OnClientClose" Modal="true"  Behaviors="Close,Move,Resize"  > 
        <Windows> 
            <telerik:RadWindow ID="radPreview" runat="server" Title="Presentation Preview" NavigateUrl="Blank.aspx" ></telerik:RadWindow> 
            <telerik:RadWindow ID="radPreviewPdf" runat="server" Title="Presentation PDF Preview" NavigateUrl="Blank.aspx"></telerik:RadWindow> 
        </Windows> 
    </telerik:RadWindowManager> 
     

     

     


     

  7. Georgi Tunev
    Admin
    Georgi Tunev avatar
    7207 posts

    Posted 14 Dec 2009 Link to this post

    Hello Orest,

    Please open a support ticket and send me a small sample that shows your exact setup and current logic. This way I will work directly on your code and provide you with the most appropriate solution.

    Thank you in advance for your cooperation.


    Regards,
    Georgi Tunev
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  8. Georgi Tunev
    Admin
    Georgi Tunev avatar
    7207 posts

    Posted 17 Dec 2009 Link to this post

    Hi guys,

    I just wanted to follow-up here as well, because when Orest sent me the project (thank you, Orest) I realized that the logic that I suggested in my reply from 3th of Dec has a flaw - when you open a RadWindow with radopen, the Url set as a first parameter in the radopen() function has a higher priority than the Url set in the NavigateUrl property. That is why Orest didn't see the loading image during the initial opening of the window.

    The solution is pretty simple - to use a small timeout before loading the PDF. Actually a timeout of 0ms should do the trick as well, but if needed, you can increase the value:
    JavaScript:
    function openWin(url) //url is the link to the pdf document
    {
        var oWnd = window.radopen(null, "radPreviewPdf");
        window.setTimeout(function() { oWnd.setUrl(url); }, 0);
    }
     
    function OnClientClose(sender, args)
    {
        var url = 'Wait.aspx';
        sender.setUrl(url);
    }

    RadWindow/Manager declaration:
    <telerik:RadWindowManager ID="RadWindowManager1" runat="server"
            OnClientClose="OnClientClose">
        <Windows>
            <telerik:RadWindow ID="radPreview" runat="server" Title="PDF Preview" NavigateUrl="Wait.aspx">
            </telerik:RadWindow>
        </Windows>
    </telerik:RadWindowManager>



    Sincerely yours,
    Georgi Tunev
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  9. SlimSjakie
    SlimSjakie avatar
    10 posts
    Member since:
    Apr 2010

    Posted 28 Jan 2011 Link to this post

    or - just simply set the ShowContentDuringLoad="false" on the RadWindow. This only works when you use the setUrl client-side method to change the contetns of the RadWindow.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017