C# – capturing the enter key on textbox in asp.net for windows ce

asp.net-2.0c++textboxwindows-mobile

I want to capture the enter key on text for windows ce msie6.0 but there is no button for that so i cannot use default button property for the form tag itself. What else i can do to capture the Enter key?

Thanks..

Best Solution

I have used this function javascript in IE6, not sure if it will work in Windows CE

    <script language="javascript">
    document.onkeydown = myOnkeydown;  
    function myOnkeydown()
    {        
        var key = window.event.keyCode;
        if (key == 13) { //13 is the keycode of the 'Enter' key
           //do stuff
        }
    }
    </script>

Edit: This function captures the input in all fields. You can plug it to the textbox of your choice if you like.