This is a migrated thread and some comments may be shown as answers.

Closing RadWindow Problems

2 Answers 91 Views
Window
This is a migrated thread and some comments may be shown as answers.
Robert
Top achievements
Rank 1
Robert asked on 22 Oct 2009, 07:05 PM
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 Answers, 1 is accepted

Sort by
0
John Fetherolf
Top achievements
Rank 1
answered on 22 Oct 2009, 07:09 PM
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;  
}  
 
0
Robert
Top achievements
Rank 1
answered on 22 Oct 2009, 08:05 PM
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();

 

}

}

Tags
Window
Asked by
Robert
Top achievements
Rank 1
Answers by
John Fetherolf
Top achievements
Rank 1
Robert
Top achievements
Rank 1
Share this question
or