Close RadWindow Programmatically

2 posts, 1 answers
  1. Robert
    Robert  avatar
    68 posts
    Member since:
    Feb 2009

    Posted 26 Oct 2011 Link to this post

    I am working with the RadWindow, and an objective is to close the RadWindow once a navigateUrl is applied to a HyperLink;
     
    The issue is with the close of the RadWindow, and how best to close the RadWindow programmatically with C# and/or JavaScript;

    Thank in advance for any insight;  Best regards - Rob 

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

    Posted 27 Oct 2011 Link to this post

    Hello Robert,

    You can try the following approaches to close the RadWindow.

    i) Try the following code to close the RadWindow by javascript.
    JS:
    <script type="text/javascript">
    function OnClientClick()
    {
      var win = $find('<%=RadWindow1.ClientID %>');
      win.Close();
    }
    </script>

    ii) Try the following code to close the RadWindow from code behind. You need to inject the javascript function to the asp label as it's text and write the client side code to close the RadWindow.

    ii) C#:
    protected void btn_Click(object sender, EventArgs e)   
    {   
      Label1.Text = "<script type='text/javascript'>Close()</" + "script>";   
    }

    JS:
    <script language ="javascript" type ="text/javascript" >  
    function GetRadWindow()     
    {     
       var oWindow = null;     
       if (window.radWindow)
       oWindow = window.RadWindow; //Will work in Moz in all cases, including clasic dialog     
       else if (window.frameElement.radWindow)
       oWindow = window.frameElement.radWindow;//IE (and Moz as well)     
       return oWindow;               
    }     
    function Close()     
    {     
      GetRadWindow().Close();          
    }         
    </script>

    Thanks,
    Princy.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top