sgunay Posted December 24, 2003 Posted December 24, 2003 Hello to everyone, i have a problem that i tried to explain. if anyone help me, i will be gratefull. My problem: i have a web form that contains an imagebutton and several text boxes. i want to give focus next textbox, when user change the current textbox text like TAB button does. i wrote code for textboxes textchange event. But the problem is each time i change text for any textbox and Press Enter, image button runs as if image button takes focus,when i press ENTER. Thanks for any idea. Suzan :confused: Quote
kahlua001 Posted December 25, 2003 Posted December 25, 2003 On pressing the enter, you can use javascript to check the other text boxes if they are filled, if not, then dont submit the form, but focus to the next empty box. Or you can add code to the onKeyDown, onKeyPress, or onKeyUp events in javascript, then you can check for the 'which' property, this will return the ASCII name of the key that was pressed. Quote
*Experts* Bucky Posted December 25, 2003 *Experts* Posted December 25, 2003 If I understand correctly, you are trying to change the focus of the textboxes with the Enter key instead of Tab. This cannot be done with ASP.NET on the server side, because the visual display of the webpage is determined by the client application (the user's web browser). You will need to use JavaScript or VBScript, like kahlua001 mentioned, to accomplish this. Also, if you have AutoPostBack set to True on the TextBox control, the TextChanged event only fires when the textbox loses focus. If AutoPostBack is false, then the event fires when the form is posted to the server. Quote "Being grown up isn't half as fun as growing up These are the best days of our lives" -The Ataris, In This Diary
sgunay Posted December 26, 2003 Author Posted December 26, 2003 Thanks Thanks this forum very much for everything. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.