I have an ASP.NET page that contains a form and a button. In order to use the OnKeyPress and a javascript function (to stop the user from using the enter key and without adding a FilteredTextBoxExtender) attribute I had to change the <asp:Textbox> to an <input> with type="text".
Is this considered bad practice? Or are there valid situtations where should be used?
To ensure this question isn’t subjective – are there any other ways to prevent the user using the enter key when typing in an ASP.NET textbox? (without putting code in the code behind)
You can add JavaScript to
<asp:TextBox />. You can either attach the JavaScript using the ClientID of the control, or you can add it in the codebehind using