
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

Here is the link:
http://www.telerik.com/help/aspnet-ajax/window_overviewchanges.html

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.
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.

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
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.

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,

Thanks for the help.
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.

<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?
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

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

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>
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

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!
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
