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

RadWindow is duplicating on multiple creations

16 Answers 211 Views
Window
This is a migrated thread and some comments may be shown as answers.
Shane Grant
Top achievements
Rank 1
Shane Grant asked on 26 Dec 2009, 01:23 AM
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.

16 Answers, 1 is accepted

Sort by
0
GT
Top achievements
Rank 1
answered on 26 Dec 2009, 02:48 PM
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


0
Shane Grant
Top achievements
Rank 1
answered on 26 Dec 2009, 07:20 PM
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.
0
Svetlina Anati
Telerik team
answered on 28 Dec 2009, 09:52 AM
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.
0
Shane Grant
Top achievements
Rank 1
answered on 30 Dec 2009, 07:09 AM
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


0
Accepted
Svetlina Anati
Telerik team
answered on 30 Dec 2009, 10:56 AM
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.
0
Shane Grant
Top achievements
Rank 1
answered on 30 Dec 2009, 10:46 PM
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,
0
Shane Grant
Top achievements
Rank 1
answered on 31 Dec 2009, 01:29 AM
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.
0
Svetlina Anati
Telerik team
answered on 31 Dec 2009, 11:05 AM
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.
0
Matt Ray
Top achievements
Rank 2
answered on 30 Jun 2010, 06:14 PM
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?

0
Georgi Tunev
Telerik team
answered on 05 Jul 2010, 12:27 PM
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
0
KRZYSZTOF
Top achievements
Rank 1
answered on 16 Sep 2010, 08:42 AM

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

0
I Nengah
Top achievements
Rank 1
answered on 16 Feb 2011, 06:27 AM
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>

 

0
Georgi Tunev
Telerik team
answered on 16 Feb 2011, 07:18 AM
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.
0
I Nengah
Top achievements
Rank 1
answered on 16 Feb 2011, 03:51 PM
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!
0
Georgi Tunev
Telerik team
answered on 21 Feb 2011, 11:59 AM
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
0
Onkaramurthy
Top achievements
Rank 1
answered on 31 Mar 2015, 02:31 PM
Thank you... Your Suggestion helped lot for me...
Tags
Window
Asked by
Shane Grant
Top achievements
Rank 1
Answers by
GT
Top achievements
Rank 1
Shane Grant
Top achievements
Rank 1
Svetlina Anati
Telerik team
Matt Ray
Top achievements
Rank 2
Georgi Tunev
Telerik team
KRZYSZTOF
Top achievements
Rank 1
I Nengah
Top achievements
Rank 1
Onkaramurthy
Top achievements
Rank 1
Share this question
or