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

Array of Radwindows

2 Answers 41 Views
Window
This is a migrated thread and some comments may be shown as answers.
Srujana
Top achievements
Rank 1
Srujana asked on 29 Jul 2011, 07:54 PM
Hello Telerik Team,

I have a requirement where I need to open bunch of( number varies based on items availability) same radwindows as modal windows where user inputs the data on each of the windows and close it to get to the next window, I need to refresh the parent page once the user is done inputting data on all the modal windows, I have a javascript function the needs to be called upon clientclose(which is going to be same for all the modal windows) where I check the number of windows active, if the active count is zero that's when I refresh the parent page, it looks like the javascript function is not attached to each instance of the modal window, but it is attached to the first instance that I see on the screen. here is my code, please let me know why the event is not attached to each of the modal windows.

Thanks in advance,
SC.

function OnClientclose(sender, eventArgs) {
  
            var manager = GetRadWindowManager();
            var windows = manager.get_windows();
             if(windows.length==0)
              {
                     //refresh parent page
               }
                
}
  
  
  
-----------------------------------------------------------------
  
//from my code behind
  
string[] strInputIDs = args1[1].Split(',');
  
for (int i = 0; i < strInputIDs.Length; i++)
  
{
  
RadWindow window = new RadWindow();
  
window.ID = "RadWindow" + i;
  
window.NavigateUrl = "Popup.aspx?ID=" + Convert.ToInt32(strInputIDs[i]) + "&Result=S";
  
window.VisibleOnPageLoad = true;
  
window.Modal = true;
  
window.Width = 550;
  
window.Height = 300;
  
window.OnClientClose = "OnClientclose";
  
RadWindowManager1.Windows.Add(window);
  
}

2 Answers, 1 is accepted

Sort by
0
Marin Bratanov
Telerik team
answered on 01 Aug 2011, 03:58 PM
Hi Srujana,

  I believe that the event handlers are attached properly, yet the condition in the if() statement would never be met, since your RadWindow object remain in the windows collection after they are closed. What I would advise is that you set the DestroyOnClose property for these windows to true so that they are disposed when closed and the windows collection will decrease in count. I have also added a small timeout to allow the RadWindow to be destroyed and removed from the collection before checking. This seems to be working fine on my end: http://screencast.com/t/T5Pk5zj1EEt. As a reference I have attached my demo page to this thread. I hope it helps you achieve the desired functionality.


Greetings,
Marin
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
Srujana
Top achievements
Rank 1
answered on 02 Aug 2011, 02:38 PM
Thanks Marin,

That helped me fix the issues.

SC.
Tags
Window
Asked by
Srujana
Top achievements
Rank 1
Answers by
Marin Bratanov
Telerik team
Srujana
Top achievements
Rank 1
Share this question
or