ascx opens a RadWindow with a ascx in it, but where did my window go?

2 posts, 0 answers
  1. Henrik Tegman
    Henrik Tegman avatar
    29 posts
    Member since:
    Apr 2010

    Posted 04 Oct 2010 Link to this post

    Hi,

    I'm going to try and explane this as good as I can.
    I have a ascx, it's very simple it only has a dropdown and some buttons.
    When I click on one of the buttons I want to open a one of my aspx sites in/with a RadWindow, this works fine.
    This aspx site has a diffrent ascx in it, and when I press a button in this ascx I want the RadWindow to close, faily simple.

    But I have a big problem in geting the RadWindow to close.
    I can ofcourse just press the red X, but I want the window to close automaticly when the user presses another button.

    My RadWindowManager is located inside the first ascx, that ascx opens a aspx that contains a ascx, when the user presses a button in that ascx I want the RadWindow to close.

    Lets give them some names:

    DropDown.ascx (has the RadWindowManager a dropdown and a button that opens up Editor.aspx)
    Editor.aspx (has the Fields.ascx control)
    Fields.ascx (a control with a lot of fields that can be edited and a save button)

    When the user presses that save button my codebehind in Editor.aspx catches this, it checks how the save goes and then I simply want that codebehind todo something like RadWindow1.Close().

    I simply can't find or get a hold of the RadWindow from Editor.aspx

    I've tried with Parent or FindControl or similar things, but I simply can't find it, and I don't know how to go on with this, how I can change it. Please help me.

    Thanks for your help.
  2. Georgi Tunev
    Admin
    Georgi Tunev avatar
    7207 posts

    Posted 07 Oct 2010 Link to this post

    Hello Henrik,

    If the RadWindow control shows external page, different from the parent one, you can close that RadWindow by getting a reference to it on the client and then call its close() method. This is needed because the RadWindow object is actually on the different page - the parent one and you cannot access it directly from the content one.

    e.g.
    function GetRadWindow()
    {
      var oWindow = null;
      if (window.radWindow)
         oWindow = window.radWindow;
      else if (window.frameElement.radWindow)
         oWindow = window.frameElement.radWindow;
      return oWindow;
    }     
     
    function closeWin()
    {
       GetRadWindow().close()
    }

    The following blog post will give you more information about how to fire a JavaScript function from server-side code
    http://blogs.telerik.com/supportdept/posts/09-05-05/executing_javascript_function_from_server-side_code.aspx


    Best wishes,
    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