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

RadWindow Problem

5 Answers 193 Views
Window
This is a migrated thread and some comments may be shown as answers.
Arindam
Top achievements
Rank 1
Arindam asked on 17 Jun 2009, 04:02 PM
Hello Friends

I am having a peculiar problem in my content page, one of my click event of a control I am creating the radwindows dynamically by following code :-
 for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                {
                    Telerik.Web.UI.RadWindow newWindow = new Telerik.Web.UI.RadWindow();
                    newWindow.VisibleOnPageLoad = true;
                    newWindow.OffsetElementID = "OffsetElement" + i.ToString();
                    newWindow.NavigateUrl = "http://www.sitefinity.com";
                    newWindow.Top = Unit.Pixel(Convert.ToInt32(ds.Tables[0].Rows[i][1]));
                    newWindow.Left = Unit.Pixel(Convert.ToInt32(ds.Tables[0].Rows[i][2]));
                    newWindow.Width = Unit.Pixel(Convert.ToInt32(ds.Tables[0].Rows[i][3]));
                    newWindow.Height = Unit.Pixel(Convert.ToInt32(ds.Tables[0].Rows[i][4]));
                    newWindow.Title = ds.Tables[0].Rows[i][0].ToString();
                    RadWindowManager1.RestrictionZoneID = SummaryDiv2.ClientID;
                    RadWindowManager1.Windows.Add(newWindow);
                   
                }

So they are populating fine, but when I am trying to save the window property like height, width etc I am not getting the radwindows in client side, for this please check the below mentioned javascript:-

function GetRADWinPrt()
        {
              var oManager = GetRadWindowManager(); // its coming NULL every time
              var oActive = oManager.get_windows();
             var winArray = new Array(oActive.length);  //eventually length is also NULL
              var strList = "";
            for(var i = 0;i<oActive.length;i++)
              {
                 //Check if Window is closed or Active
                 if(!(oActive[i].isClosed()))
                 {
                     var bound = oActive[i].getWindowBounds();
                     strList = strList + oActive[i].get_name() + "=" + bound.x +","+ bound.y + "," + bound.width + "," + bound.height + ";";
                 }
              }
              
              //Stored all active RADWindow properties in hidden field
              document.getElementById(strHidden).value = strList;
              alert(strList);
         }

My RadwindowManager is
<telerik:RadWindowManager ID="RadWindowManager1" runat="server" VisibleOnPageLoad="true"
                    VisibleTitlebar="true" VisibleStatusbar="false"
                    ReloadOnShow ="true" ShowContentDuringLoad="false" RestrictionZoneID="SummaryDiv2"
                    Overlay="true" Animation="Fade"
                    MinimizeZoneID="MyMinWins" OnClientCommand="oCCWindow" >
</telerik:RadWindowManager>

Also if I create RadWindow using window.radopen() in javascript then the above function i.e. GetRADWinPrt() works fine, but not work if I created my radWindow from Server side i.e. the for loop that I shown in the code snippet.
Could you please tell me where I am going wrong.

Thanks
Arindam R

5 Answers, 1 is accepted

Sort by
0
Georgi Tunev
Telerik team
answered on 18 Jun 2009, 11:12 AM
Hi Arindam,

I assume you are using Ajax to create the windows. If this is so, please note that all RadWindowManager's functions like GetRadWindowManager(), radopen(), radalert(), etc. are always using the original RadWindowManager that is first rendered on the page. When you ajaxify the RadWindowManager control, it is destroyed during the Ajax call and then recreated again, however the manager's functions are still looking for the original one.

In your scenario I suggest to use the native ASP.NET AJAX $find("<%= ControlName.ClientID %>") function to get a reference to the RadWindowManager. If you still experience problems after that, please open a support ticket and send us a sample project that reproduces your setup and logic so we could examine it locally.


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
Arindam
Top achievements
Rank 1
answered on 18 Jun 2009, 12:31 PM
Hello Georgi,

Thanks for your reply.

I modified the code as below, please check I am having one problem marked in BOLD :-

function GetRADWinPrt()
        {
      
              var radM = $find('<%=RadWindowManager1.ClientID %>');
              var A = radM.get_windows(); // Problem is I am still not getting all my windows, is that I am taking the wrong property!!!
              var winArray = new Array(A.length);
             strList = "";
             for(var i = 0;i<A.length;i++)
              {
                 //Check if Window is closed or Active
                 if(!(A[i].isClosed()))
                 {
                     var bound = A[i].getWindowBounds();
                     strList = strList + A[i].get_name() + "=" + bound.x +","+ bound.y + "," + bound.width + "," + bound.height + ";";
                 }
              }
              
              //Stored all active RADWindow properties in hidden field
              document.getElementById(strHidden).value = strList;
              alert(strList);
            
        }

Regards
Arindam R
0
Georgi Tunev
Telerik team
answered on 19 Jun 2009, 12:14 PM
Hi Arindam,

I reproduced the problem locally and logged it in our database. Unfortunately at this point the only suggestion I can give is either not to use Ajax when adding the windows in the manager or to create them on the client. We will do our best to improve the behavior of the RadWindow control in this scenario in one of the future updates.

Your points were updated.


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
Eric
Top achievements
Rank 1
answered on 09 Jul 2009, 09:21 AM
Georgi,

I have a problem that might be the same... I'd like your opinion on this.

I have a complex page using master pages and Ajax manager and proxy.

I define several windows in the RadWindowManager at design time.

 

The following code shows that get_windows() returns nothing.

var
oManager = GetRadWindowManager();

 

alert(oManager.get_windows());

Do you think that it is the same problem?

I am just trying to call a javascript function on a dialog...
If this is the same problem, I'll try to fire the function getting through the frame (or whatever other) collection.
Otherwise, any idea where this might come from?


Thanks


Eric

0
Georgi Tunev
Telerik team
answered on 09 Jul 2009, 12:32 PM
Hi Eric,

If it is the same setup as Arindam's and you are ajaxifying the RadWindowManager for some reason, yes this could be the reason. The good news is that this exact problem - RadWindowManager not finding its windows in the Windows collection after being updated with Ajax - is fixed in Q2 2009. For convenience I attached a small sample that shows the problem that was fixed. If you run the sample with an older version of the control, you will get empty collection after reloading the manager with Ajax. If you are using Q2 2009 however, everything will work as expected.

Please make sure that you are using the latest version of the control. If you still experience problems after that, it will be best to open a support ticket and to send me a small sample project where the problem is isolated. I will check it and get back to you right away.

All the best,
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.
Tags
Window
Asked by
Arindam
Top achievements
Rank 1
Answers by
Georgi Tunev
Telerik team
Arindam
Top achievements
Rank 1
Eric
Top achievements
Rank 1
Share this question
or