RadWindow is duplicating on multiple creations

17 posts, 1 answers
  1. Shane Grant
    Shane Grant avatar
    20 posts
    Member since:
    Dec 2009

    Posted 25 Dec 2009 Link to this post

    I wasn't sure the best way to describe this, but here is what I have:

    I have a RadMenu with Help -> About
    When I click about here is the code that is fired:

            protected void aboutClick() 
            { 
                RadWindow windowAbout = new RadWindow(); 
                // Set the window properties  
                windowAbout.NavigateUrl = "~/windows/about.aspx"
                windowAbout.ID = "RadWindowAbout"
                windowAbout.VisibleOnPageLoad = true;  
                windowAbout.Title = "About"
                windowAbout.VisibleStatusbar = false
                //windowAbout.Animation = WindowAnimation.FlyIn; 
                windowAbout.Width = new Unit(400, UnitType.Pixel); 
                windowAbout.Height = new Unit(310, UnitType.Pixel); 
                //windowAbout.Modal = true; 
                windowAbout.DestroyOnClose = true
                windowAbout.Behaviors = WindowBehaviors.Close | WindowBehaviors.Move; 
                RadWindowManager1.Windows.Add(windowAbout); 
            } 

    With or without making the window modal the first time I select about everything is fine. The second time I select it I get two instances of the window, and third time I get three.

    Any help is appreciated.
  2. GT
    GT avatar
    52 posts
    Member since:
    May 2006

    Posted 26 Dec 2009 Link to this post

    Try setting enableviewstate to false. There was a change in Q3 regarding the creation of the windows from the server.
    Here is the link:
    http://www.telerik.com/help/aspnet-ajax/window_overviewchanges.html


  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Shane Grant
    Shane Grant avatar
    20 posts
    Member since:
    Dec 2009

    Posted 26 Dec 2009 Link to this post

    Thanks Hulky for the suggestion, but that did not make a difference.

    Ultimately I would prefer to create the window on the client side, but I was unable to figured out how to trigger the javascript create function from a RadMenu item.
  5. Svetlina Anati
    Admin
    Svetlina Anati avatar
    2795 posts

    Posted 28 Dec 2009 Link to this post

    Hello Shane Grant,

    I examined your code and I also believe that the only problem in this case could be the fact that you have used the VisibleOnPageLoad property with ViewState enabled and setting EnableViewState="false" for the RadWindowManager should fix this.

    On a side note, if you want to dynamically create a RadWindow object on the client you should use the radopen function - e.g call it in the client click event of the menu item, this will create the new RadWindow. You can examine the following demos to get a better overview about this function:

    http://demos.telerik.com/aspnet-ajax/window/examples/radopen/defaultcs.aspx
    http://demos.telerik.com/aspnet-ajax/window/examples/windowmanager/defaultcs.aspx
    http://demos.telerik.com/aspnet-ajax/controls/examples/integration/gridandwindow/defaultcs.aspx?product=window
    http://demos.telerik.com/aspnet-ajax/window/examples/usingurlforserverarguments/defaultcs.aspx

    Greetings,
    Svetlina
    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. Shane Grant
    Shane Grant avatar
    20 posts
    Member since:
    Dec 2009

    Posted 30 Dec 2009 Link to this post

    Svetlina,

    Setting EnableViewState="false" on the RadWindowManager does stop it from duplicating the About Window, but I am using the same RadWindowManager for other windows that I need to persist through postbacks, and this causes all windows to vanish on any page postback.

    My workaround was as follows:

    1. I added a second RadWindowManager:
        <telerik:RadWindowManager ID="RadWindowManagerDocumentArea" runat="server" RestrictionZoneID="RestrictionZone"  
            ShowContentDuringLoad="false"
        </telerik:RadWindowManager> 
        <telerik:RadWindowManager ID="RadWindowManagerPopupWindows" runat="server" RestrictionZoneID="RestrictionZone"  
            ShowContentDuringLoad="false" EnableViewState="false"
        </telerik:RadWindowManager> 

    Then I simply add the About window into the second manager like this:
            protected void aboutClick() 
            { 
                RadWindow windowAbout = new RadWindow(); 
                // Set the window properties  
                windowAbout.NavigateUrl = "~/windows/about.aspx"
                windowAbout.ID = "RadWindowAbout"
                windowAbout.VisibleOnPageLoad = true// Set this property to True for showing window from code  
                windowAbout.Title = "About"
                windowAbout.VisibleStatusbar = false
                //windowAbout.Animation = WindowAnimation.FlyIn; 
                windowAbout.Width = new Unit(400, UnitType.Pixel); 
                windowAbout.Height = new Unit(310, UnitType.Pixel); 
                windowAbout.Modal = true
                windowAbout.EnableViewState = false
                windowAbout.DestroyOnClose = true
                windowAbout.Behaviors = WindowBehaviors.Close; 
                RadWindowManagerPopupWindows.Windows.Add(windowAbout); 
            } 

    This seems to resolve the duplication issue.

    Thank you for your help


  7. Answer
    Svetlina Anati
    Admin
    Svetlina Anati avatar
    2795 posts

    Posted 30 Dec 2009 Link to this post

    Hello Shane,

    In this case I recommend not to use a second RadWindowManager but to use one RadWindow with EnableViewState="false" and one RadWindowManager for all the other RadWindows with ViewState enabled. I recommend this because the RadWindowManager control is designed to be a singleton and if you have more than one on your page only one of them will be "active" depedning on the initialization time of the managers and this can cause problems. However, there is absolutely no problem to have as many additional separate RadWindows on the page and if you use a separate RadWindow, setting EnableViewState="false" for it will solve the VisibleOnPageLoad problem.


    Best wishes,
    Svetlina
    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. Shane Grant
    Shane Grant avatar
    20 posts
    Member since:
    Dec 2009

    Posted 30 Dec 2009 Link to this post

    Svetlina,

    I have tried to only use one window manager, but the second time I click help about in the menu I tget two of the windows, and the third time I get three. Is there maybe something else I might be doing wrong?

    Thank you,
  9. Shane Grant
    Shane Grant avatar
    20 posts
    Member since:
    Dec 2009

    Posted 30 Dec 2009 Link to this post

    I added a placeholder to the page, and then simply add the window as a modal to the placeholder and it seems to work out pretty good.

    Thanks for the help.
  10. Svetlina Anati
    Admin
    Svetlina Anati avatar
    2795 posts

    Posted 31 Dec 2009 Link to this post

    Hello Shane,

    I am glad you were able to make the things work as you require. In case you experience further problems or you have additional questions, I will be happy to assist.


    Regards,
    Svetlina
    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.
  11. Matt Ray
    Matt Ray avatar
    4 posts
    Member since:
    Mar 2010

    Posted 30 Jun 2010 Link to this post

    I am having the same issue with this. I have a radMenu that calls code-behind that adds it to my RadWindowManager1's windows collection. In-page, my RadWindowManager is set up like:

     

     

    <telerik:RadWindowManager ID="RadWindowManager1" runat="server" Behaviors="Resize, Minimize, Close, Pin, Move, Reload" 
                     KeepInScreenBounds="True" VisibleOnPageLoad="False" 
                    Behavior="Resize, Minimize, Close, Pin, Move, Reload" InitialBehavior="None" 
                    Height="520px" RestrictionZoneID="pnlMainContent" VisibleStatusbar="False"   
                    Width="870px" DestroyOnClose="True" EnableViewState="False">  
                </telerik:RadWindowManager> 

    This is great because it no longer duplicates, but now (as this guy mentions) I am unable to have multiple windows shown through a postback. What am I doing wrong?

  12. Georgi Tunev
    Admin
    Georgi Tunev avatar
    7207 posts

    Posted 05 Jul 2010 Link to this post

    Hello Matt,

    The behavior that you experience is expected. DestroyOnClose destroys RadWindow's client object - it does not affect the control on the server. RadWindow does not provide the requested functionality out of the box (because this would mean that you would need to make a trip to the server every time you click the [X] button).
    To implement the desired logic, we would suggest to manually clear the Windows collection on the server when needed.

    I hope this information helps.

    Regards,
    Georgi Tunev
    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
  13. KRZYSZTOF
    KRZYSZTOF avatar
    11 posts
    Member since:
    Jul 2010

    Posted 16 Sep 2010 Link to this post

    hello

    i have also encounter this problem with radwindows, but it turned out that adding <yourradwindowsmanagername>.Windows.Clear(); in code behind solved the problem

    maybe this helps you

    regards

    ksysiek

  14. I Nengah
    I Nengah avatar
    2 posts
    Member since:
    Oct 2010

    Posted 16 Feb 2011 Link to this post

    I have problem with my RadWindow, it only opens the first time being clicked. If it's clicked the second time and so on, it will load empty window.

    Please advice, and below is my code.

    Thank you,
    Mustika

    function

     

    openWin2() {

     

     

    window.radopen(

    null, "RadWinAttachment");

     

     

     

    return false;

     

     

    }


    <

     

    telerik:RadWindowManager ID="RadWindowManager2" runat="server">

     

     

    <Windows>

     

     

    <telerik:RadWindow ID="RadWinAttachment" runat="server" Skin="<%$appSettings:TelerikSkin%>"

     

     

    DestroyOnClose="true" ReloadOnShow="true" EnableEmbeddedSkins="false" Width="500px" Height="350px" NavigateUrl="~/Pages/AttachmentNew_Prop.aspx"

     

     

    Modal="true" VisibleTitlebar="true" Behaviors="Close">

     

     

    </telerik:RadWindow>

     

     

    </Windows>

     

     

    </

     

    telerik:RadWindowManager>

     


    <

     

    asp:LinkButton ID="LinkButton1" OnClientClick="return openWin2();" runat="server">Add Attachment to this Claim</asp:LinkButton>

     

  15. Georgi Tunev
    Admin
    Georgi Tunev avatar
    7207 posts

    Posted 16 Feb 2011 Link to this post

    Hi Nengah,

    This happens when you set DestroyOnClose to true. When this property is set to true, RadWindow’s object will be destroyed once the window is closed. This, however,  means that you will not be able to open that same RadWindow again until the whole page is reloaded.
    In such scenario, it will be best to either set all needed properties (width, height, modality, etc.) to the RadWindowManager or as an alternative – to use the client-side API and set them when opening the RadWindow.


    Kind regards,
    Georgi Tunev
    the Telerik team
    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
  16. I Nengah
    I Nengah avatar
    2 posts
    Member since:
    Oct 2010

    Posted 16 Feb 2011 Link to this post

    Hi Georgi,

    Thank you for your prompt response.

    If I set the DestroyOnClose property to false, the same window will be loaded when a different RadWindow control is being invoked (I have several link buttons opening different RadWindows).

    The client-side API makes sense, but I am not clear when you said to set the properties (width, height, modality, etc.) to the RadWindowManager for opening these RadWindows. Can you enlighten me?

    Thank you again!
  17. Georgi Tunev
    Admin
    Georgi Tunev avatar
    7207 posts

    Posted 21 Feb 2011 Link to this post

    Hi Nengah,

    Basically, the RadWindowManager control allows you to set common properties for all RadWindows opened from it. This means that if you have set different properties like Width, Height, Modal, OnClientClose, etc., all RadWindows opened from that RadWindowManager will have these settings pre-set.



    All the best,
    Georgi Tunev
    the Telerik team
  18. Onkaramurthy
    Onkaramurthy avatar
    8 posts
    Member since:
    Dec 2013

    Posted 31 Mar 2015 in reply to Svetlina Anati Link to this post

    Thank you... Your Suggestion helped lot for me...
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017