Custom Close radwindow

2 posts, 0 answers
  1. wnl
    wnl avatar
    106 posts
    Member since:
    Aug 2007

    Posted 15 Jul 2009 Link to this post

    Hi,
    I want to override default close in radwindow (at top-right icon).
    I tried in js:

    TelerikTelerik.Web.UI.RadWindow.prototype.oldClose = Telerik.Web.UI.RadWindow.prototype.close;  
    Telerik.Web.UI.RadWindow.prototype.close = function(callBackFnArg) {  
        //your code goes here     
        alert("closing");  
        //call old close method     
        this.oldClose(callBackFnArg);  
    }; 
    but I get an error about: no definition of 'Telerik'.
    So how can I write my own close function in js?
  2. Fiko
    Admin
    Fiko avatar
    1406 posts

    Posted 16 Jul 2009 Link to this post

    Hi Jaromin,

    In the newer versions of the RadWindiow control (Q3 2008 and later) we implemented an OnClientBeforeClose event. In your case you could use this event and implement your logic in its handler. Also you could cancel the close by using the following simple approach :

    • attach the event handler :
      <telerik:RadWindow ID="RadWindow1" runat="server" OnClientBeforeClose="OnWindowCloseHandler"
      </telerik:RadWindow> 
    • Implement the handler as follow :
      function OnWindowCloseHandler(oWindow, args) 
          // Your logic here ... 
       
          // You could cancel the closing
          args.set_cancel(true); 

    I hope this helps.

    Greetings,
    Fiko
    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.
Back to Top