0

I have a text box for number input. Validator works fine for range 1 to 100, but it still allows the return key to be used. I want to tell ASP.NET, using VB, to ignore a return key press. Any ideas?

2
Contributors
1
Reply
3
Views
7 Years
Discussion Span
Last Post by serkan sendur
0

you can do that using javascript.

<script language="javascript" type="text/javascript">
function stopRKey(evt) {
	var evt  = (evt) ? evt : ((event) ? event : null);
	var node = (evt.target) ? evt.target : ((evt.srcElement) ? evt.srcElement : null);
	if ((evt.keyCode == 13) && (node.type=="text")) { return false; }
}
document.onkeypress = stopRKey;
</script>
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.