Closing RadWindow Problems

3 posts, 0 answers
  1. Robert
    Robert avatar
    198 posts
    Member since:
    Aug 2009

    Posted 22 Oct 2009 Link to this post

    I have a RadWindow opened and I can click on the 'X' or Click on a Close button.  The OnClientClick event basically does a oWnd.close().  

    The problem is I need to be able to close this window from the 'Close' button when the user hits the Enter key. When I do this it causes a postback.  Normally I would return false.  But I can't return false because the window.close() method takes me out of context. 

    Anyone?
  2. John Fetherolf
    John Fetherolf avatar
    17 posts
    Member since:
    Sep 2008

    Posted 22 Oct 2009 Link to this post

    Will it help to write javascript keyboard handler that explicitly handles the <enter> key?  This is what we do on all of our popup pages.  Usually each of our modal pages has a keyboard handler at the page-level like this:

     
    //  Make the page behave like a Windows popup dialog.  
    function OnPageKey(evt) {  
        var thisKey = (evt) ? evt.which : window.event.keyCode;  
          
        switch(thisKey) {  
            case keyEnter:  
                btnSave.click();  
                break;  
                  
            case keyEscape:  
                CloseRadWindow();  
                break;  
        }  
          
        return true;  
    }  
     
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Robert
    Robert avatar
    198 posts
    Member since:
    Aug 2009

    Posted 22 Oct 2009 Link to this post

    Thanks for the reply.

    Something like this is actually giving me the results I need from the onKeyPress event:

     

    function keypressed()

     

    {

     

    if(event.keyCode=='13')

     

    {

     

    event.cancelBubble=true;

     

    window.returnValue=

    false;

     

     

    return btnCancel_onClick();

     

    }

    }

Back to Top