Showing RadWindow on Parent from Custom Control

6 posts, 0 answers
  1. Quintin
    Quintin avatar
    7 posts
    Member since:
    Aug 2011

    Posted 03 Jul 2012 Link to this post

    Hi,

    I have a ascx user control on a page which has a cancel button and on the container/parent page is the RadWindow.

    How do I show this parent RadWindow in Javascript onclick of the button?

    Thanks
  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 03 Jul 2012 Link to this post

    Hi Quintin,

    Try the following Javascript to achieve your scenario.

    JS:
    <script type="text/javascript" >
     function OnClientClick()
      {
        var oWnd = radopen("URL", "RadWindow1");
        return false;
      }
    </script>

    Hope this helps.

    Thanks,
    Princy.
  3. Quintin
    Quintin avatar
    7 posts
    Member since:
    Aug 2011

    Posted 04 Jul 2012 Link to this post

    Thanks for the reply Princy.

    The RadWindow I am trying to open is defined on the parent page and contains a contenttemplate. I need to specifically open the instance defined on the parent page and not a new RadWindow with a URL.

    I tried this from server side but the window does not display unless I set VisibleOnPageLoad = true but then the page continuously displays on postback:

    RadWindow
     radWin = (RadWindow)this.Parent.FindControl("winListings");             
    newOrderWindowManager.Windows.Add(radWin); 

    Thanks!
  4. rdmptn
    rdmptn avatar
    72 posts
    Member since:
    Aug 2011

    Posted 04 Jul 2012 Link to this post

    Why don't you just use JavaScript to open it then? Instead of setting its VisibleOnPageLoad property to true you should employ the approach from this thread:http://www.telerik.com/community/forums/aspnet-ajax/window/opening-radwindow-from-the-server.aspx. Once you access the control from the code-behind you can use its ClientID property.

    An alternative is to add the OnClientClick script from the code-behind, something like :
    RadWindow myRW = ....;//get your RadWIndow here by traversing the control tree 
    myButton.OnClientClick = "$find('" + myRW.ClientID + "').show(); return false;";

  5. Quintin
    Quintin avatar
    7 posts
    Member since:
    Aug 2011

    Posted 04 Jul 2012 Link to this post

    Thanks, that may work. I guess my question is how do I go about traversing the parent controls?
  6. rdmptn
    rdmptn avatar
    72 posts
    Member since:
    Aug 2011

    Posted 06 Jul 2012 Link to this post

    Just like you did in your previous post? I mean this line:
    RadWindow radWin = (RadWindow)this.Parent.FindControl("winListings");
    //and then you need
    radWin.ClientID
Back to Top