Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / ASP.NET > Window > Issues with DestroyOnClose and second clicks
RadControls for ASP.NET are no longer supported (see this page for reference). In case you have inquiries about the Telerik ASP.NET AJAX controls, post them in the pertinent ASP.NET AJAX forums.

Issues with DestroyOnClose and second clicks

Feed from this thread
  • Mario Morales avatar

    Posted on Oct 18, 2006 (permalink)

    Hi,

    I am having some issues with the window control.  Let me try to explain how I am trying to use this.

    I have a search results page that brings back a number of thumbnails of videos.  I then add an onClick Attribute to each hyperlink of the thumbnail like follows:

    lbnTest.Attributes.Add("onClick""ShowWindow('player.aspx?url=http://www.somesite.com/file.wmv&mn=file_name');"

    Then I have the following JS on the search results page, as well as the code for the RadWindowManager.

    <script>  
        function ShowWindow(url)  
        {  
         var oManager = GetRadWindowManager();  
           
         var oWin = oManager.Open(url, 'rwVideoWindow');  
         oWin.Width = 355;  
         oWin.Height = 335;  
         oWin.Center();  
         return false;  
        }  
    </script>  
     

    <radW:RadWindowManager ID="rwmMain" runat="server">  
        <Windows> 
            <radW:RadWindow ID="rwVideoWindow" runat="server" Width="355" Height="335" Modal="True" Skin="Default" SkinsPath="~/RadControls/Window/Skins" DestroyOnClose="true" /> 
        </Windows> 
    </radW:RadWindowManager> 


    Now the issue.  It seems on first click of any thumbnail the new window gets centered fine, it is modal and when I close it is destroyed (if DestroyOnClose isn't set to true, you can still here the video being played)

    However, each next click it doesn't seem to honor the code in the RadWindowManager - size isn't right, it's not modal etc.  It does seem to pick up the couple of JS settings like Center, Width and Height.  How do I set other properties.  I tried something like:

    oWin.DestroyOnClose = true;

    But that didn't help.  Any suggestions on how to fix this would be appreciated.

  • Tervel Tervel admin's avatar

    Posted on Oct 19, 2006 (permalink)

    Hello Mario,

    You set the DestroyOnClose on the property to true, to eliminate the video playing while the window is not visible. This is correct approach. However, please note that next time you call Open, you do not open the same rwVideoWindow as it was destroyed! You open a new window with the default RadWindowManager settings.

    To solve your problem, you should declare the Width, Height and Modal properties in the RadWindowManager, and all newly opened windows will have those.

    We hope this helps,
    Tervel
    the telerik team

  • Mario Morales avatar

    Posted on Oct 19, 2006 (permalink)

    I changed my RadWindowManger as suggested, the DestroyOnClose, Width and Height property now work.  But the modal does not.  Works fine the first click and then after that it is no longer modal. 

    <radW:RadWindowManager ID="rwmMain" runat="server" Width="355" Height="335" Modal="True" Skin="Default" SkinsPath="~/RadControls/Window/Skins" DestroyOnClose="true">  
        <Windows> 
            <radW:RadWindow ID="rwVideoWindow" runat="server" Width="355" Height="335" Modal="True" Skin="Default" SkinsPath="~/RadControls/Window/Skins" DestroyOnClose="true" /> 
        </Windows> 
    </radW:RadWindowManager> 


    I also tried adding it to the JS and it didn't work either, please advise.

        function ShowWindow(url)  
        {  
         var oManager = GetRadWindowManager();  
           
         var oWin = oManager.Open(url, 'rwVideoWindow');  
         oWin.Modal = true;  
         oWin.Center();  
        } 

    Thank you

  • Georgi Tunev Georgi Tunev admin's avatar

    Posted on Oct 20, 2006 (permalink)

    Hi Mario,

    Thank you for bringing the problem with the modality to our attention. I have logged it in our database and we will fix it for the next update of the control.

    As for your initial problem, our suggestion is to set the window's property ReloadOnShow=true. After that you can set the window's Html to an empty string in the OnClientClose() event:
    function OnClientClose(rwd)  
        {  
          rwd.GetContentFrame().contentWindow.document.body.innerHTML = "";  
        } 

    Thus you will get the same result as when setting DestroyOnClose to true (remove the DestroyOnClose property from your code, or set it to false).


    If you still experience problems, please open a ticket and send us a full, runnable project which reproduces the behavior that you are experiencing. We will check it and do our best to provide a solution.



    Best wishes,
    Georgi Tunev
    the telerik team

  • Shosh avatar

    Posted on Jun 19, 2011 (permalink)

    Great !! it works.

Back to Top

Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / ASP.NET > Window > Issues with DestroyOnClose and second clicks