/ Published in: jQuery
                    
                                        
13 is Enter key
return false cancels the postback
<p>In this case I am calling the javascript <strong>doPostBack and telling it to execute the txtBox<em>TextChanged method
brief tutorial on _</em>doPostBack here: <a href="http://aspalliance.com/895_Understanding_the_JavaScript___doPostBack_Function.all">http://aspalliance.com/895<em>Understanding_the_JavaScript___doPostBack_Function.all</a></p>
                return false cancels the postback
<p>In this case I am calling the javascript <strong>doPostBack and telling it to execute the txtBox<em>TextChanged method
brief tutorial on _</em>doPostBack here: <a href="http://aspalliance.com/895_Understanding_the_JavaScript___doPostBack_Function.all">http://aspalliance.com/895<em>Understanding_the_JavaScript___doPostBack_Function.all</a></p>
                            
                                Expand |
                                Embed | Plain Text
                            
                        
                        Copy this code and paste it in your HTML
//prevent page submit on enter key press
//call the postback javascript then cancel the enter key press
$(document).keydown(function (e) {
if (e.keyCode == 13) {
__doPostBack('txtBox_TextChanged', '');
return false;
}
});
Comments
 Subscribe to comments
                    Subscribe to comments
                
                