469,602 Members | 1,794 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,602 developers. It's quick & easy.

How to implement key press event

Hello my friends ,

How to implement key press event for checking whether the value entered in the text box is integer.(ie if we press any alphabetic letter in the text box, at the key press it show a message it is not allowed in the text box)

Regards
Thomas Kannathara
Nov 8 '07 #1
7 2764
mathewgk80
103 100+
Hello my friends ,

How to implement key press event for checking whether the value entered in the text box is integer.(ie if we press any alphabetic letter in the text box, at the key press it show a message it is not allowed in the text box)

Regards
Thomas Kannathara
Hi Thomas,

Are yu using c#.net or vb.net??
Please specify it...

Regards,

Mathew
Nov 8 '07 #2
Hi Thomas,

Are yu using c#.net or vb.net??
Please specify it...

Regards,

Mathew
i am working in C#.net..................
Nov 8 '07 #3
i am working in C#.net and ASP.Net
Dec 6 '07 #4
Shashi Sadasivan
1,435 Expert 1GB
Have you tried the rangeValidators available for Asp.Net ?

you cant have a seperate keypress event for web pages.. unless you want to use ajax.

You could use the editvaluchanged event, but that will cause a lot of postbacks and will highly affect the performance.
Dec 6 '07 #5
Hello my friends ,

How to implement key press event for checking whether the value entered in the text box is integer.(ie if we press any alphabetic letter in the text box, at the key press it show a message it is not allowed in the text box)

Regards
Thomas Kannathara

Use javascript


function RestrictKeys(evt)
{
var e=evt ? evt : window.event;

var key =e.charCode;
if ((key ==126) ||(key==124)&&(key!=8))
{
return false;
}
else
return true;
}
Mar 3 '08 #6
I have written code here:
[Link Removed]
Mar 3 '08 #7
MMcCarthy
14,534 Expert Mod 8TB
@ Rajeshshewale

If you wish to submit code please submit it in the thread and not using a link.

ADMIN
Mar 3 '08 #8

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

6 posts views Thread by guoqi zheng | last post: by
6 posts views Thread by Rado | last post: by
22 posts views Thread by Ricky W. Hunt | last post: by
1 post views Thread by =?Utf-8?B?QXNhZg==?= | last post: by
4 posts views Thread by guiromero | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.