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

RadWindow will open and close until Postback, then never comes back until refresh of page

20 Answers 1054 Views
Window
This is a migrated thread and some comments may be shown as answers.
Michael
Top achievements
Rank 1
Michael asked on 20 Aug 2008, 02:41 AM
I have a user control that includes the following RadWindow declaration:

<telerik:RadWindowManager ID="rwmSelectImageManager" runat="server" SkinID="TelerikRadWindowManager"
  <Windows> 
    <telerik:RadWindow ID="rwSelectImage" runat="server" Behaviors="Move, Close, Resize, Maximize" 
      Title="Select Image" SkinID="TelerikRadWindow" Height="450px" Width="675px" Modal="True" 
      ClientCallBackFunction="CallBackFunction" > 
    </telerik:RadWindow> 
  </Windows> 
</telerik:RadWindowManager> 

The javascript which opens the RadWindow is being injected using RegisterClientScriptBlock in the Page_Load event.  Before injecting, I use the IsClientScriptBlockRegistered method to see if it needs to be added first to prevent multiple inclusions.

I am then placing this control into various custom DotNetNuke modules.  If the module does not have any postbacks, the RadWindow opens and closes as many times as you want based on clicking a LinkButton (part of the user control).  However, when the user control is placed in a module that has postbacks, the RadWindow will open and close many times, unti la postback occurs, then the window will no longer open when the LinkButton is pressed.  Instead, I get a the DNN progress indicator as if a postback is occuring (rather than the client side script normally called) and the window never shows.  Everything else in the module remains active.

Here's the javascript function that shows the RadWindow:

function ShowDialog() 
{  
  var oWnd = window.radopen(null, 'rwSelectImage');  
  oWnd.setUrl(oWnd.get_navigateUrl()); 

The DestroyOnClose is not set (and I believe the default value is False).  Also, here is the javascript called to close the RadWindow (it is inside of the aspx page loaded in the window:

function ImageClicked(imageName) 
  var oWindow = GetRadWindow(); 
     
  var arg = new Object(); 
  arg.SelectedImageName = imageName
             
  oWindow.Close(arg);        
}    


Can you please advise as to why it will no longer show the window after a postback occurs?  It will show again fine if I reload the page, but that is clearly not a solution ;-)

Thanks!

Michael



20 Answers, 1 is accepted

Sort by
0
Michael
Top achievements
Rank 1
answered on 20 Aug 2008, 01:29 PM
A little more research has revealed the following...

Here is the stack trace of the javascript generated by the RadWindow and RadWindowManager...

Upon inspection, the _windows property of "this" is null.

As always I appreciate your assistance with troubleshooting these issues.

Please advise.

Thanks!

Michael
0
Michael
Top achievements
Rank 1
answered on 21 Aug 2008, 12:11 PM
Telerik,

Please respond.

Regards,

Michael
0
Georgi Tunev
Telerik team
answered on 21 Aug 2008, 01:09 PM
Hi Michael,

Regarding the error that you get with the RadWindow for ASP.NET AJAX - this happens if the RadWindowManager is ajaxified in some way first and then you try to execute one of its client functions - radopen, radalert, etc. We are familiar with this problem and we will fix it for one of the following updates.
For now we suggest as a workaround to declare a second RadWindowManager which is not ajaxified and is declared before the first RadWindowManager. 

Please, note that the forums are considered community resource and although we closely monitor them, we do not guarantee a timely response here. That is why we strongly recommend to use our support ticketing system from your Client.Net account, where the response time is set depending on the support package. In addition, you can also attach files (e.g. sample reproduction projects, screenshots) there if needed.  


Greetings,
Georgi Tunev
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Michael
Top achievements
Rank 1
answered on 21 Aug 2008, 03:08 PM
Georgi,

Thanks for the reply.  Your point is well noted on submitting support tickets for a faster response.  I will use that in the future.

Regarding the issue and the workaround you mentioned...

We are using DotNetNuke as this control is included in custom modules we are developing.  With that in mind, I am not sure how I could add a second RadWindowManager that will not be "ajaxified" since DNN adds that automatically to your module.  I suppose I could uncheck the module setting called "Supports Partial Rendering" and then add my own explicit UpdatePanel to our module.  Then I could add the second RadWindowManager as you mention.

Even still, how will the second RadWindowManager be declared?  Will I also have to duplicate the Window declaration within it?  Can you provide an example using the code I supplied?

Rather than use that solution, though, is it possible to workaround this issue using something in my code behind... meaning, on PostBack perform some logic against the window or the window manager that resets it or adjusts to remedy this issue?


Thanks!

Michael
0
Georgi Tunev
Telerik team
answered on 22 Aug 2008, 09:11 AM
Hello Michael,

Basically if you use RadWindowManager's server-side API and open RadWindows from the codebehind (VisibleOnPageLoad=true), you should not experience problems with the Ajaxified RadWindowManager - this happens only when the RadWindowManager is reloaded with Ajax and then radopen/radconfirm etc. is called.

As for your last question - should the manager be identical with the old one - yes. Actually if you are using only the client-side API of the RadWindowManager I recommend to use only one which will be excluded from ajaxifying - e.g. is not in an Ajax panel that is reloaded with Ajax at some point in the logic.


Best wishes,
Georgi Tunev
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Remi
Top achievements
Rank 2
answered on 22 Aug 2008, 07:49 PM
Hello,

Thanks for posting Michael.

We're having the same issue.

We're opening a radwindow from a radgrid gridbuttoncolumn -- all ajaxified.

The window disappears after a few seconds most times, requiring a refresh to allow the window to be reopened again (because when it opens / disappears it can't open again until a page refresh). 1 or 2 times out of 10 the window actually remains open and functions normally.

Thanks again -- we look forward to seeing this functionality corrected in Q3.

0
Michael
Top achievements
Rank 1
answered on 22 Aug 2008, 08:31 PM
To help others... here is how I worked around this issue:

1.  Remove the call to ShowDialog() from the OnClientClick of the control used to trigger the window... matter of fact, remove the javascript function as well

2.  Add the openerElementID property of the RadWindow and set it to the control I want to trigger the window to appear:

openerElementId="<%# btnSelectImage.ClientID %>"

3.  Add this code to the Page_Load eventof the ascx or aspx the window is defined within (not the aspx loaded into the RadWindow):

      if (!IsPostBack)
      {
        Page.DataBind();
      }

I think that is everything.  Works just fine for me this way.  Hope this helps you!  This means you will do a postback, though.

Still looking forward to a pure client side solution from Telerik.

Michael
0
Boris Gheihman
Top achievements
Rank 1
answered on 20 Nov 2008, 04:15 AM
I installed yesterday Q3 version of RadControls for ASPNET AJAX. Problem still exists. Based on release notes no major issues were fixed in RadWindow. It's very disappointing. I have a project that extensively use Telerik controls (RadGrid, RadWindow, RadTabStrip). I use RadWindow and RadAjaxManager on parent page to partially refresh some RadGrids. It's a big chunk of the project and same approach is used in multiple places. This bug makes it unusable and it's hard to justify using Telerik for speed of development when you hit such an issue that late in development cycle.
In one of the posts you suggest:
For now we suggest as a workaround to declare a second RadWindowManager which is not ajaxified and is declared before the first RadWindowManager.
Could you, please, elaborate a bit on the topic?
0
Svetlina Anati
Telerik team
answered on 21 Nov 2008, 08:42 AM
Hello Boris,

As explained we are aware of the problem when ajaxifying the RadWindowManager control - after the update of the control, the radopen methods search for the "old" RadWindowManager control which was destroyed on the update and that is the missing object which causes the error. However, this problem is not easy to be solved and that is why we cannot tell you exactly when it will be solved - as Georgi said, the fix will be available in one of our next releases, we cannot tell in which one exactly because we are still working on this problem.

As to the suggestion of adding another RadWindowManager, it should work, just add additional manager before the one which already declared and do not ajaxify it. In this setup, the radopen, radalert, etc. functions will be actually called for the not ajaxified RadWindowmanager because the first created one is the active one when there are multiple RadWindowManagers on the page.


Kind regards,
Svetlina
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Gary
Top achievements
Rank 1
answered on 24 Nov 2008, 04:14 PM
Hi-

What's the wotkaround if you have a control that contains the RadWindowManager and this control is contained in another control that wraps it in an RadAjaxPanel?

Here's the markup of the control with the radwindowmanager:
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="KitProducts.ascx.cs" Inherits="MIDI_Internal.Products.UserControls.KitProducts" %> 
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %> 
 
<telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">  
    <script type="text/javascript">  
 
 
 
        function ShowPanelInsertForm(kitId)                                                                                                                                                                                                                                                                                    
        {  
           window.radopen("ProductList.aspx?kitId=" + kitId, "RadWindow2");  
           return false;  
        }  
 
        function refreshKitProductsGrid(arg)  
          
        {  
            //try to refresh grid here...  
            $find("<%= RadAjaxManager.GetCurrent(Page).ClientID %>").ajaxRequest("ProductKitRebind");   
 
        }  
 
    </script> 
</telerik:RadCodeBlock>   
 
    <telerik:RadAjaxManagerProxy ID="RadAjaxManagerProxy1" runat="server">  
        <AjaxSettings> 
            <telerik:AjaxSetting AjaxControlID="RadGridLookup">  
                <UpdatedControls> 
                    <telerik:AjaxUpdatedControl ControlID="RadGridLookup" /> 
                </UpdatedControls> 
            </telerik:AjaxSetting> 
        </AjaxSettings> 
    </telerik:RadAjaxManagerProxy> 
 
    <asp:ObjectDataSource ID="ObjectDataSourceLookup" runat="server"   
        DeleteMethod="Delete" InsertMethod="Insert"   
        SelectMethod="RetrieveKitProducts"   
        TypeName="MIDI_Internal.BLL_KitProduct"   
        OnSelecting="OnDataSourceSelecting"   
        OnInserting="OnDataSourceInserting" > 
        <DeleteParameters> 
            <asp:Parameter Name="KitProductId" Type="Int32" /> 
        </DeleteParameters> 
        <SelectParameters> 
            <asp:Parameter Name="ProductId" Type="Int32" /> 
        </SelectParameters> 
        <InsertParameters> 
            <asp:Parameter Name="KitId" Type="Int32" /> 
            <asp:Parameter Name="ProductId" Type="Int32" /> 
        </InsertParameters> 
    </asp:ObjectDataSource> 
<h3>Kit Products</h3> 
<br /> 
 
    <telerik:RadGrid ID="RadGridLookup" runat="server" AllowFilteringByColumn="false" 
        AllowPaging="False" AllowSorting="True" GridLines="None" Skin="Mac"   
        EnableAJAX="true" AllowAutomaticDeletes="True" 
        AllowAutomaticInserts="True" 
        Width="90%"   
        DataSourceID="ObjectDataSourceLookup"   
        OnItemCreated="RadGridLookup_ItemCreated"   
    onitemdatabound="RadGridLookup_OnItemDataBound" > 
 
        <MasterTableView AllowMultiColumnSorting="True" PageSize="15" CommandItemDisplay="Top" 
                    AutoGenerateColumns="False" DataKeyNames="KitProductId" DataSourceID="ObjectDataSourceLookup"   
                    EditMode="PopUp">  
        <RowIndicatorColumn Visible="False">  
            <HeaderStyle Width="20px"></HeaderStyle> 
        </RowIndicatorColumn> 
        <ExpandCollapseColumn Visible="False" Resizable="False">  
        <HeaderStyle Width="20px"></HeaderStyle> 
        </ExpandCollapseColumn> 
            <Columns> 
                <telerik:GridBoundColumn DataField="KitProductID" HeaderText="KitProductID" UniqueName="KitProductId" Visible="false" ReadOnly="true">  
                </telerik:GridBoundColumn> 
                <telerik:GridBoundColumn DataField="KitID" HeaderText="Kit ID" UniqueName="KitId" Visible="false" ReadOnly="true">  
                </telerik:GridBoundColumn> 
                <telerik:GridTemplateColumn HeaderText="Product Id" UniqueName="ProductIdLink" CurrentFilterFunction="EqualTo" AutoPostBackOnFilter="true">  
                    <ItemTemplate> 
                        <asp:HyperLink ID="hlnkProductInfo" runat="server" NavigateUrl="" Target="_blank" Text='<%#Eval("ProductId") %>' /> 
                    </ItemTemplate> 
                    <EditItemTemplate> 
                        <asp:TextBox ID="txtProductId" runat="server" Text='<%#Bind("ProductId") %>' /> 
                    </EditItemTemplate> 
                </telerik:GridTemplateColumn> 
                <telerik:GridBoundColumn DataField="NSN" HeaderText="NSN" UniqueName="NSN" Visible="true" ReadOnly="true"  CurrentFilterFunction="Contains" AutoPostBackOnFilter="true" SortExpression="NSN">  
                </telerik:GridBoundColumn> 
                <telerik:GridBoundColumn DataField="CageCode" HeaderText="CAGE" UniqueName="CAGE" Visible="true" ReadOnly="true" CurrentFilterFunction="Contains" AutoPostBackOnFilter="true" SortExpression="CageCode">  
                </telerik:GridBoundColumn> 
 
                <telerik:GridButtonColumn ConfirmText="Are you sure you want to delete this record?" ButtonType="ImageButton" ImageUrl="~\RadControls\Skins\Mac\Grid\Delete.gif" CommandName="Delete" Text="Delete" UniqueName="DeleteColumn">  
                        <HeaderStyle Width="20px" /> 
                </telerik:GridButtonColumn> 
            </Columns> 
 
            <CommandItemTemplate> 
                <asp:Image ID="Image1" ImageUrl="~/App_Themes/Theme3/Images/actions/AddRecord.gif" runat="server" /><a href="#" ID="ShowInsertForm" runat="server" onclick="return ShowPanelInsertForm();" ><span>Add Product to Kit</span></a>  
            </CommandItemTemplate> 
 
        </MasterTableView> 
 
    </telerik:RadGrid> 
      
 
    <telerik:RadWindowManager ID="RadWindowManager1" runat="server"   
        NavigateUrl="" SkinsPath="~/RadControls/Window/Skins" Title="Product Details" Skin="Mac"  ReloadOnShow="false" Modal="true" KeepInScreenBounds="false"  ShowContentDuringLoad="false" Behavior="Close, Reload, Resize, Move, Maximize" > 
        <Windows> 
            <telerik:RadWindow ID="RadWindow2"  KeepInScreenBounds="true" runat="server" Modal="True" SkinsPath="~/RadControls/Window/Skins" Title="Product Details" Width="800px" Height="500px"  /> 
        </Windows> 
    </telerik:RadWindowManager> 
 

And the snippet of code from the control that wraps the above control:
            <telerik:RadPanelItem runat="server" Text="Kit Products" Expanded="False" Value="hdritemKitProducts" Width="90%">  
                <Items> 
                    <telerik:RadPanelItem runat="server" Value="itemKitProducts" Width="90%">  
                        <ItemTemplate> 
                            <telerik:RadAjaxPanel ID="RadAjaxPanelKitProducts" LoadingPanelID="radLoadingPanel" runat="server" > 
                                 <ucKitGrid:KitProducts ID="KitInformation" runat="server"  /> 
                            </telerik:RadAjaxPanel> 
                        </ItemTemplate> 
                    </telerik:RadPanelItem> 
                </Items> 
            </telerik:RadPanelItem> 
 

Thanks,
Gary
0
Svetlina Anati
Telerik team
answered on 27 Nov 2008, 11:42 AM
Hi Gary,

Would you please try just moving the RadWindowManager on the main page, outside the RadAjaxPanel and test again? As far as I see from your code, it will work if the RadWindowManager is on the main page as well as when you have it wrapped in the user control.

Regards,
Svetlina
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Andrew Benson
Top achievements
Rank 2
answered on 13 Dec 2008, 09:30 PM

I had the same problem as Gary. The RadWindowManager (RWM) was embedded in a UserControl. Once I moved it to the page everything worked fine! I was able to get an instance of the page's RWM from the embedded user control using the client api.

 

I haven't tested this yet, but I wonder what would happen if you had 2 RWM controls. How would the GetWindowManager function behave?

0
Svetlina Anati
Telerik team
answered on 16 Dec 2008, 11:46 AM
Hi guys,

Would you please make sure that you are using the latest version of RadWindow, namely Q3 2008, SP1, v 2008.3.1125 ? This problem is fixed there and I tested both with older version where I was able to get the error and after that with the latest version - in this case the error disappeared. I recommend to upgrade to the latest build of the controls because this is the best and most reliable manner to fix the issue.

In case you are able to reproduce the problem with the latest build, please prepare a sample reproduction demo, open a new support ticket and send it to us along with the dll and detailed reproduction instructions.


Greetings,
Svetlina
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Will Ngo
Top achievements
Rank 1
answered on 16 Feb 2009, 02:51 AM
Hi Telerik

Has the problem describted in Borises, Andrews and Garys regarding ajaxified RadWindowManager been fixed in Q3 2008.3 1314?

I just upgraded to it but it seems still exists.

In my case, the client side windows collection obtained from get_windows() always returns length=0 or getWindowById() always returns undefined.

The RadWindowManager is contained in a UserControl dynamically loaded from an ajax request generated from a RadMenu item click. As soon as I turned off Ajax (by setting EnableAJAX="false" in RadAjaxManager) the problem goes away.

Thanks



0
Georgi Tunev
Telerik team
answered on 16 Feb 2009, 07:18 AM
Hi Will,

In such case, please open a support ticket and send us a small sample application where the problem can be observed. I am asking you this because we've managed to fix the problem for a lot of scenarios, but it is possible that we missed some. We will check it and if possible - will provide you with immediate solution.


Kind regards,
Georgi Tunev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Aami
Top achievements
Rank 1
answered on 28 Mar 2013, 06:08 AM
I had a similar problem of Radwindow not opening after postback. What Andrew Benson suggested worked for me. Thanks.
0
Lorena
Top achievements
Rank 1
answered on 29 Aug 2013, 07:57 AM
Hi Telerik team,

I have the same problem (it's stange...ticket opened 5 years ago....). I am using Telerik ASP.NET AJAX controls - Q2 2013 - .net 4.5.

I cannot use the RadWindowManager control because of some ajax related issues. So I am using only RadWindow. I have on a .aspx page, among others...a RadButton and a RadWindow (the RadWindow will open another .aspx page):
<telerik:RadButton runat="server" ID="rbtnAddTires" Text="<%$Resources:Richiesta, NewReqAddTires %>" Icon-PrimaryIconCssClass="rbAdd" AutoPostBack="false"></telerik:RadButton>
<telerik:RadWindow runat="server" ID="rwChooseTires" Title="<%$Resources:Richiesta, ChooseTires%>" EnableShadow="true" Width="1300px" Height="600px" Modal="true" CenterIfModal="true"
DestroyOnClose="true" ReloadOnShow="true" ShowContentDuringLoad="false" OnClientClose="rwChooseTires_Close" NavigateUrl="~/Dialogs/InsTyre.aspx">
</telerik:RadWindow>

and on the Page_Load of this web page I have:
this.rwChooseTires.OpenerElementID = this.rbtnAddTires.ClientID;

It's working only for the first time when RadWindow is opened. After it is closed, the RadButton doesn't popup the RadWindow anymore.
I also tried to set the openerElementId on the client side, every time the RadWindows is closed, in the OnClientClose:
function rwChooseTires_Close(sender, args) {
    var rwTires = $find("<%= rwChooseTires.ClientID %>");
    if (rwTires) {
        if (rwTires._openerElementId == null || rwTires._openerElementId == "") {
            rwTires.SetOpenerElementId("<%= rbtnAddTires.ClientID %>");
        }
    }
}

, with no luck. The behaviour is the same: i can open the RadWindow only once.

Can you please advise?
Thank's
Lorena
0
Marin Bratanov
Telerik team
answered on 30 Aug 2013, 01:40 PM
Hello Lorena,

Your issues stems from the fact that the RadWindow has its DestroyOnClose property set to true (but you need it set to false), so when it is closed its instance is destroyed and then you cannot open it again, until the control is disposed (either in a partial, or in a full postback), so when the page comes back again it will be created.
This is explained in this help article: http://www.telerik.com/help/aspnet-ajax/window-troubleshooting-common.html.

Regards,
Marin Bratanov
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
0
Lorena
Top achievements
Rank 1
answered on 02 Sep 2013, 10:13 AM
Hi Marin,

thank you, changing the property DestroyOnClose to false worked.
However I returned to an old problem now: performance issues. Could you please confirm to me that my understanding of RadWindow, and its property NavigateUrl, is correct: if DestroyOnClose is set to false, after the first appearence of RadWindow at run time, all the content of the external .aspx web page (set through the NavigateUrl property of the RadWindow) is copied into the main .aspx page? And if yes, can I prevent this in other way than setting DestroyOnClose property to true? (because the RadWindow should be opened multiple times between postbacks of the main page).

Thank you once again for your support,
Lorena
0
Marin Bratanov
Telerik team
answered on 03 Sep 2013, 12:20 PM
Hi Lorena,

When a page is loaded in a RadWindow through its NavigateUrl property this URL is set as the src attribute of an iframe that loads the page, we cannot just copy content from another page and have it function. This demo will explain the difference between the two modes of the popup.

If you want to unload this page when the RadWindow closes you can navigate it to about:blank in its OnClientClose event:
function OnClientClose(sender, args) {
   sender.setUrl("about:blank");
}



What I can suggest as a better approach for your case is to have a RadWindowManager with DestroyOnClose set to true (because otherwise new instances will not have this property) and use the RadWindow's Client-side API to set their properties after opening them, e.g.:
var wnd = radopen(url, null);
wnd.set_destroyOnClose(true);
wnd.setSize(width, height);
wnd.set_modal(bModal);
//and so on, as needed by the current RadWindow that is being opened



Regards,
Marin Bratanov
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
Tags
Window
Asked by
Michael
Top achievements
Rank 1
Answers by
Michael
Top achievements
Rank 1
Georgi Tunev
Telerik team
Remi
Top achievements
Rank 2
Boris Gheihman
Top achievements
Rank 1
Svetlina Anati
Telerik team
Gary
Top achievements
Rank 1
Andrew Benson
Top achievements
Rank 2
Will Ngo
Top achievements
Rank 1
Aami
Top achievements
Rank 1
Lorena
Top achievements
Rank 1
Marin Bratanov
Telerik team
Share this question
or