Click here to Skip to main content
Rate this: bad
Please Sign up or sign in to vote.
See more: C# ASP.NET
I have to do something like that....
In textbox we can not enter numeric value.if I enter lowercase letter then it automatically convert into uppercase letter.And if I enter uppercase letter then it can accept as it is.
I have to do this using javascript (.js file in solution explorer)
please tell me how to do this..
Posted 21-Dec-12 5:25am
Edited 24-Dec-12 1:54am
joshrduncan2012 at 21-Dec-12 10:34am
What have you done to accomplish this so far?
Rate this: bad
Please Sign up or sign in to vote.

Solution 4

You can simply use style="text-transform:uppercase" in your textbox declaration.
Example :
<asp:TextBox style="text-transform:uppercase" runat="server" ID="myTextBox" />
GANESH KUMAR K at 24-Dec-12 7:08am
wow Super.... @Rajesh Kuramdasu....
I was trying in javascript But it's really superb very small matter.. Thanks alot :-)
Rate this: bad
Please Sign up or sign in to vote.

Solution 3

You can do the uppercase part very simply by using CSS:
<input id="myInput" style="text-transform: uppercase" type="text" />
The non-numeric as well needs a little more complexity:
     <script language="JavaScript">
       function noNumerics(evt)
         var e = event || evt;
         var charCode = e.which || e.keyCode;
         if ((charCode >= 48) && (charCode <= 57))
            return false;
         return true;
     <input id="yourid" style="text-transform: uppercase" type="text" onkeypress="return noNumerics();"/>
[edit]Wrong name for function![/edit]
Member 9511889 at 22-Dec-12 7:43am
in c# this code is not working.
onkeypress is not available.
please help me.
OriginalGriff at 22-Dec-12 8:01am
Look at the code above: See the bit which starts
script language="JavaScript"
That should be a clue where it goes...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Advertise | Privacy | Mobile
Web02 | 2.8.150302.1 | Last Updated 24 Dec 2012
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100