In ASP.NET, if there are multiple text boxes in the same page, press the "Enter" button in each text box, will respond to the first Button's Click event, how can I pay freely to press the Enter key without triggering Unexpected response or how to get a different response in different places, this problem has been troubled, and it is not completely solved until there is currently, first discusses the income and share with you, with a view to throwing brick jade. First, press the Enter key in the page without trigger a response if the entire page does not need to set up the carriage return, I hope to press the Enter key in any place in the page does not cause a response, and the full page will be turned through. For Tab, the method is to add the following code in the file head:
Event.keycode == 13)
Event.Keycode = 9;
script>
Second, press the Enter key in different places to get different responses If there are multiple text boxes (TextBox) on the same page, each text box corresponds to a different submission button, such as "login" page, there is " Enter the mailbox number "and" Enter the account "two text boxes and" Enter Mailbox "," Enter the Community "two buttons. The effect of hope is: 1. Enter the mailbox number and enter the event, respond to the event of "enter the mailbox" button, simply, "Enter the Mailbox" button will display "mailbox: ****" in the "Information Display" text box (where *** is input Mailbox number), as shown below: 2. Enter the account after entering the account, respond to the event of "enter the community" button, simply, "Enter the Community" button will display the "Community: ****" in the "Information Display" text box (where *** is the entered community Account number, as shown below: Implementation steps are as follows: