472,779 Members | 2,844 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,779 software developers and data experts.

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 3030
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

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

Similar topics

8
by: dixie | last post by:
I want to run an event when I press the Ctl key simultaneously with the K key. How do I achieve this in VBA? dixie
3
by: Brett Hall | last post by:
I have a VB.NET interface that my managed C++ code is to implement. I seem to be stuck implementing an event defined in that interface. Does anyone have a simple code snippet that will show me...
6
by: guoqi zheng | last post by:
In a regular html form, when user press "enter" key, the form will be submitted. However, in ASP.NET web form, a form will only be submitted (post back) when a special button is clicked. Many...
3
by: raj | last post by:
hi, i have one textbox and one save button, i have added attribute at page load event btnSave.Attributes.Add("onclick","return ValidateForm();"); in validationform() ,I have written like this...
6
by: Rado | last post by:
Hello. In Event key_press I write If e.KeyChar = Microsoft.VisualBasic.Chr(127) Then Asci 127 is key DELET. But it doesn't work, when I get other Ascii It's ok. And When I press...
22
by: Ricky W. Hunt | last post by:
First, the subject probably doesn't use the correct terms but I'm not sure what it's called in VB. I'm writing a media player app. The subroutine that handles the "open file" button contains an...
1
by: daonho | last post by:
I tried to use javascript to trigger up the button click function when user press enter key from the textbox. This function work fine with a single button click such has login page. However, if the...
1
by: =?Utf-8?B?QXNhZg==?= | last post by:
Hello, I have a Default.aspx page with several controls in a Master Page. When pressing on a Button control Page_Load event is fired on the Default.aspx page and after that the Page_Load event...
3
by: win | last post by:
How to get the keycode press in a web form Vincent
0
by: Rina0 | last post by:
Cybersecurity engineering is a specialized field that focuses on the design, development, and implementation of systems, processes, and technologies that protect against cyber threats and...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 2 August 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: erikbower65 | last post by:
Here's a concise step-by-step guide for manually installing IntelliJ IDEA: 1. Download: Visit the official JetBrains website and download the IntelliJ IDEA Community or Ultimate edition based on...
0
by: kcodez | last post by:
As a H5 game development enthusiast, I recently wrote a very interesting little game - Toy Claw ((http://claw.kjeek.com/))。Here I will summarize and share the development experience here, and hope it...
0
by: Taofi | last post by:
I try to insert a new record but the error message says the number of query names and destination fields are not the same This are my field names ID, Budgeted, Actual, Status and Differences ...
0
by: Rina0 | last post by:
I am looking for a Python code to find the longest common subsequence of two strings. I found this blog post that describes the length of longest common subsequence problem and provides a solution in...
0
by: lllomh | last post by:
How does React native implement an English player?
0
by: Mushico | last post by:
How to calculate date of retirement from date of birth
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.