Using radwindow in a user control – upto 20 on a page

4 posts, 0 answers
  1. James
    James avatar
    70 posts
    Member since:
    Jun 2009

    Posted 01 Oct 2010 Link to this post

    Hi. We have a user control that has a rad window and rad window manager. The control accepts a couple of parameters (used to build the url to display) and has a few custom events – like window closed that are exposed to the calling page.


    We now have a requirement to use this control upto 20 times on a single page. I am sure that having the user control on the page 20 times, with 20 different radwindow managers and 20 different radwindows is probably not the best way to do this.

    We still want it as a user control as the exact same functionality is required on multiple different pages,  and like wise multiple times on some pages.

    What is the best way to achieve this? can you have a single window and manager and share it between all instances of the user control for example?

  2. Cori
    Cori avatar
    562 posts
    Member since:
    Jul 2010

    Posted 01 Oct 2010 Link to this post

    Hello James,

    I'm guessing it could be possible, as long as the RadWindow being referenced in the UserControls use the same name.

    So if you add the RadWindowManager and RadWindow on the page that you will be placing the user controls on, you can access the RadWindowManager from the page by calling GetRadWindowManager() in the user controls, which should return to you the first RadWindowManager registered to the page. From there you can call the RadWindow's like you normally would.

    I hope that helps.
  3. James
    James avatar
    70 posts
    Member since:
    Jun 2009

    Posted 01 Oct 2010 Link to this post

    i guess it's a similar conecpt to having a single ajax script manager and multiple ajax controls on a page.....

    if you can always get a reference as easily as GetRadWindowManager()  then that does make it fairly easy. i think. i'll have a play and see where i get to
  4. Georgi Tunev
    Georgi Tunev avatar
    7207 posts

    Posted 04 Oct 2010 Link to this post

    Hello James,

    Basically - yes, you could have multiple RadWindowManagers per page. In such  case however, you need to take into consideration the following:

       1. All RadWindowManager's functions (radopen, radalert, radconfirm, radprompt, GetRadWindowManager, etc) are always using the first rendered RadWindowManager on the page.
       2. Every RadWindowManager "knows" only the RadWindows that are declared in its Windows collection.

    This means that if you have a RadWindow2 declared in RadWindowManager2, and you use something like radopen(myUrl, "RadWindow2");, radopen will use RadWindowManager1 and will open a new RadWindow with the settings taken from RadWindowManager1. To avoid that problem, when you have multiple managers on a page, you need to get a reference to the correct RadWindowManager first and then call its methods.
    var manager = $find("<%= RadWindowManager2.ClientID %>");, "RadWindow2");

    Sincerely yours,
    Georgi Tunev
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Back to Top