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

RadWindow not using settings

8 Answers 270 Views
Window
This is a migrated thread and some comments may be shown as answers.
JP
Top achievements
Rank 1
JP asked on 19 Mar 2008, 08:39 PM
I'm converting our project to use Prometheus controls, which has been an unpleasant undertaking so far.  I like the new controls once I get them working again, but that has been a real challenge.  My current problem is the RadWindow. 

I have this in my aspx file:

<telerik:RadWindowManager ID="multipleRoomWindowManager" runat="server" Skin="Web20">        
    <Windows> 
        <telerik:RadWindow  
            ID="winMultipleRoom" 
            runat="server"  
            Height="600px" 
            Width="400px" />             
    </Windows>   
</telerik:RadWindowManager> 

and I have this as the javascript function that opens the window:
function openRadWindow(url) 
    var myWindow = radopen(url, "winMultipleRoom"); 

Calling radopen seems to create a new window instead of opening the one I set the settings for.  I don't want to set all my settings from javascript, and I also need that url to be dynamically set.

In messing with it, it seems to have the same behavior as if I never declared any of the aspx code.  There has got to be a better way of doing this.

8 Answers, 1 is accepted

Sort by
0
Georgi Tunev
Telerik team
answered on 20 Mar 2008, 11:40 AM
Hello JP,

The code that you provided is working fine and you should not experience this problems. Just to play on the safe side, I just tested your code and as you can see from the attached movie, everything is working as expected. Can you please check it and let me know if I am missing something?

If you still experience problems, please open a support ticket and send us a project that can be run and which reproduces these problems. We will check it and do our best to help right away.



Kind regards,
Georgi Tunev
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
JP
Top achievements
Rank 1
answered on 20 Mar 2008, 03:50 PM
Thanks for the demo.  After looking at your demo and testing stuff on a clean project, I was able to discover that the problem seems to be when I have a RadWindowManager on my master page as well as one on my page.  Is the expected behavior to put all the windows I will use (I use about 20 of them) on the master page or add them through code?
0
Georgi Tunev
Telerik team
answered on 21 Mar 2008, 10:11 AM
Hello JP,

When you have multiple RadWindowManagers on your page (like in your case when you use MasterPage), the managers will be rendered on the page and you can use them all.
When you call radopen() however, the function will use only the last rendered RadWindowManager on your page which (the RadWindowManager) "knows" only the RadWindows that are declared in its Windows collection.

This being said, I would suggest not to use radopen() in such scenarios, but to use the ASP.NET AJAX convention and use $find(), to find the needed control and then call its show() method.
e.g
function findAndOpen() 
    var oWnd = $find("<%= RadWindow1.ClientID %>"); 
    oWnd.setUrl("http://www.google.com"); 
    oWnd.show(); 

I hope this helps.


Regards,
Georgi Tunev
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
JP
Top achievements
Rank 1
answered on 21 Mar 2008, 03:56 PM
Awesome.  That works great.  Thanks for the advice.
0
Justin
Top achievements
Rank 2
answered on 30 Apr 2008, 02:59 PM
I'm having a slightly similar issue.  I'm using RadControls for ASP.NET AJAX Q1-2008 and converting over pages that used RadControls for ASP.NET Q2-2007 which, from my understanding, combined multiple RadWindowManagers into one at runtime.  Let me explain the scenario..

My masterpage contains a RadWindowManager (and subsequent RadWindows defined).  One of my content pages also has a RadWindowManager with its own RadWindows collection.  I'm trying to use a single javascript function for opening my windows on the content page, passing it the serverside id and destination url.

function OpenNewWindow(windowName, theUrl)
{
  var oManager = GetRadWindowManager();
  var oWnd = oManager.GetWindowByName(windowName);
  if (oWnd)
  {
      oWnd.setUrl(theUrl);
      oWnd.show();
  }
}

This functionality used to work, but doesn't now.  I think its trying to find my window in the RadWindowManager located on the masterpage and is unable to find it.  The only solution I found was to wrap this in a RadCodeBlock and replace the oManager assignment with:

var oManager = $find("<%= RadWindowManager1.ClientID %>");

Is there a better solution and is that really how it's intended to work?
0
Svetlina Anati
Telerik team
answered on 30 Apr 2008, 04:30 PM
Hello Justin,

Please, note that the client-side API of RadControls for ASP.NET AJAX uses different naming conventions than the one of RadControls for ASP.NET. This being said, while introducing the new client-side, some of the "old" methods were still working but in the official release Q1 2008 the migration was completely done.

Therefore for example the GetRadWindowManager() method will work with RadControls for ASP.NET Q2-2007 and to get it to work you should change it to get_windowManager(). You can check the control's API here.

Please, note that the MasterPage is an INamingContainer and it changes the elements' IDs and you should use the ClientIDs when you obtain references to them.

Greetings,
Svetlina
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Justin
Top achievements
Rank 2
answered on 01 May 2008, 12:39 PM
Well, I tried using "var oManager = get_windowManager();" as you suggested, but it throws a javascript error "Object expected" or in Firefox, "get_windowManager is not defined".  I've encapsulated the javascript within a RadCodeBlock.

Also, the documentation and previously releases of RadControls for ASP.NET all say to refer to the server id of the window you're trying to locate.   "var oWnd = oManager.getWindowByName(serverWindowName);" seems to work fine when i use $find("<%= RadWindowManager1.ClientID %>"); to locate the windowmanager.  My concern is that the name of it could change at some point and GetRadWindowManager, as it was previously called, was a universal function call.
0
Svetlina Anati
Telerik team
answered on 05 May 2008, 08:57 AM
Hi Justin,

Please, excuse me for the misunderstanding, the get_windowManager() method is a RadWindow's method and it returns the RadWindowManager which contains a referenced RadWindow. In your case you discuss another function, which is global  - GetRadWindowManager() and returns the RadWindowManager without referencing a RadWindow object.

When you have RadWindowManagers both on a MasterPage and ContentPage, you have a resultant page with two RadWindowManager controls. The GetRadWindowManager() method returns only the first manager it "meets" while looping through page's controls and in this case this is the RadWindowManager, declared on the MasterPage - you can verify this by selecting the ViewSource option in your browser.

This being said, if you have RadWindowManagers bith on the MasterPage and on the ContentPage, the method will return the one which is declared in the MasterPage. If you delete the manager on the MasterPage and test again, the method will return the RadWindowManager which is declared on the ContentPage.

Therefore, when you want to obtain a reference to a particular RadWindowManager and it is not the first one rendered on the page, you should provide its id explicitly. In your specific case this should be its ClientID due to using MasterPage which is an INamingContainer.

I prepared a sample project which demonstrates this - you can find it in the attached archive file.

All the best,
Svetlina
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
Window
Asked by
JP
Top achievements
Rank 1
Answers by
Georgi Tunev
Telerik team
JP
Top achievements
Rank 1
Justin
Top achievements
Rank 2
Svetlina Anati
Telerik team
Share this question
or