Close Radwindow on Button

3 posts, 0 answers
  1. Rahul
    Rahul avatar
    142 posts
    Member since:
    May 2009

    Posted 18 May 2009 Link to this post

    I want to close the radwindow on button click .... i have one from on that form show radwindow button after that button mouse over open rad window. In that rad window one Employee.aspx form on that form close button. when i click that button close the open radwindow+Employee.aspx form. How to close it ?
    i am trying this code 

     

    <input id="CloseButton" title="BAck to main Window" type="button" value="Close Form" onclick ="Closerad(); " /></td>

     

     

    function Closerad()

     

    {

     

     

     

    var oManager = GetRadWindowManager();

     

     

     

    var oWnd = oManager.GetWindowByName("RadWindow1");

     

     

     

     

     

    //oWnd.Hide();

     

     

     

     

     

    oWnd.Close();

    document.getElementById(

     

    "Button2").focus ();

     

     

    }

    but it showing script erro object Expected of employee.aspx form . how to resolve this problem urgent

    Its urgent

    Thank you so Much !!!!!!!!

     

  2. Svetlina Anati
    Admin
    Svetlina Anati avatar
    2795 posts

    Posted 18 May 2009 Link to this post

    Hi rahul,

    I already answered your other thread and for your convenience I pasetd my reply below. Please, note, that your other thread was for RadWindow for ASP.NET and this one is for RadWindow for ASP.NET AJAX and I am not sure what exact version you are actually using. In case you use the RadWindow for ASP.NET, you should use the method Close, with a capital "C", otherwise - with a small letter - close (this is important since javascript is case sensitive).

    I am not sure whether you want to close the RadWindow from the main page or from within its content page. That is why I will describe the both scenarios for you.

    Closing a RadWindow from the main page

    In order to close the RadWindow from the main page, you should first obtain a reference to it (e,g with $find, depending on your setup) and then call its method close().

    Closing a RdaWindow from its content page (e.g on button click)

    The logic is the same but in order to get a reference to the RadWindow from inside it you should use the following GetRadWindow() function:

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

    After you have declared this function, you should reference the RadWindow object and close it when needed as GetRadWindow().close().

    You can find the GetRadWindow function in our online demos and documentation, e.g in the article below:

    http://www.telerik.com/help/aspnet-ajax/window_programmingopeningfromwithin.html

    and the close method is available in the control's client-side API reference:

    http://www.telerik.com/help/aspnet-ajax/window_programmingradwindowmethods.html

    I hope that my explanations are detailed enough and helpful, let me know how it goes.

    Kind regards,

    Svetlina
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  3. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 18 May 2009 Link to this post

    Hello Rahul,

    Try out the following client side code for closing the RadWindow on clicking the button which is placed in the RadWindow page.

    JavaScript in Employee.aspx:
             
    <script type="text/javascript"
    function CloseWindow() 
        var oWindow = GetRadWindow();  //Obtaining a reference to the current window 
        oWindow.Close(); 
    function GetRadWindow() 
       var oWindow = null
       if (window.radWindow) oWindow = window.radWindow; 
       else if (window.frameElement.radWindow) oWindow = window.frameElement.radWindow; 
       return oWindow; 
    </script> 

    If you want to focus to a button which is placed in parent page after closing the window, then you can add the code for that in OnClientClose() event of RadWindow. Attach the OnClientClose() event and try the client side code as shown below.

    JavaScript:
     
    <script type="text/javascript"
    function OnClientClose() 
        document.getElementById("Button2").focus(); 
    </script> 

    Thanks,
    Shinu.
Back to Top