Reputation: 2201
In asp.net, I have a text edit control, and when I press enter, it clicks some button I have which isn't related to the text edit control.
Is there a way to disable the enter key for the text edit control?
Upvotes: 0
Views: 611
Reputation: 3823
If it's WebForms, you could use something like onkeydown = "return (event.keyCode!=13);"
in your asp:TextBox.
Full example:
<asp:TextBox ID="TextBox1" runat="server" onkeydown="return (event.keyCode!=13);">
This answer is coming from: disabling default button or enter key in c#
Upvotes: 3