Set Behavior via javascript

3 posts, 0 answers
  1. Andrew
    Andrew avatar
    125 posts
    Member since:
    Sep 2008

    Posted 26 Mar 2009 Link to this post

    How can I set the behavior of a radwindow via javascript?
  2. Andrew
    Andrew avatar
    125 posts
    Member since:
    Sep 2008

    Posted 26 Mar 2009 Link to this post

    Ok, I found out how but it does not seem to work? here is my JS.

    function

     

    OpenWindow(navigateURL, radWindow, Width, Height) {

     

     

     

    var parentPage = GetRadWindow().BrowserWindow;

     

     

    var parentRadWindowManager = parentPage.GetRadWindowManager();

     

     

    var oWnd = parentRadWindowManager.open(navigateURL, radWindow);

     

    oWnd.setSize(Width, Height);

    oWnd.set_behaviors(Telerik.Web.UI.WindowBehaviors.Move + Telerik.Web.UI.WindowBehaviors.Close);

     

    //oWnd.show();

     

     

    }

    I have tried with an dwithout the call to show.

  3. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 27 Mar 2009 Link to this post

    Hi Andrew,

     

    I am not sure about the setup that you tried. I guess you are trying to set the behaviors of the second RadWindow from the already opened RadWindow, because the client side code you posted is working fine in that case (I have added RadWindowManager in the page that is opened in the first RadWindow and also added the GetRadWindow() method).

    ASPX:

    <telerik:RadWindowManager ID="RadWindowManager1" runat="server">  
    </telerik:RadWindowManager> 
    <input id="Button2" type="button" value="OpenWindow"  onclick="OpenWindow();"/> 

    JavaScript:

    <script type="text/javascript">  
    function GetRadWindow()  
    {  
      var oWindow = null;  
      if (window.radWindow)  
         oWindow = window.radWindow;  
      else if (window.frameElement.radWindow)  
         oWindow = window.frameElement.radWindow;  
      return oWindow;  
    }  
    function OpenWindow(navigateURL, radWindow, Width, Height)   
    {  
        var parentPage = GetRadWindow().BrowserWindow;  
        var parentRadWindowManager = parentPage.GetRadWindowManager();  
        var oWnd = parentRadWindowManager.open('http://www.google.com''window2');  
        oWnd.setSize(300, 250);  
        oWnd.set_behaviors(Telerik.Web.UI.WindowBehaviors.Move + Telerik.Web.UI.WindowBehaviors.Close);  
    }  
    </script> 

     

    If you are using a single RadWindow and want to set the behaviors while showing the window, then you can set the behaviors like this.
    JavaScript:

    <script type="text/javascript">  
    function OpenWindow(navigateURL, radWindow, Width, Height)   
    {  
        var oWnd = window.radopen('http://www.google.com''window2');  
        oWnd.setSize(300, 250);  
        oWnd.set_behaviors(Telerik.Web.UI.WindowBehaviors.Move + Telerik.Web.UI.WindowBehaviors.Close);  
    }  
    </script> 

    Thanks,
    Princy.

Back to Top