Click here to Skip to main content
Rate this: bad
good
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 4:25am
Edited 24-Dec-12 0:54am
v3
Comments
joshrduncan2012 at 21-Dec-12 10:34am
   
What have you done to accomplish this so far?
Rate this: bad
good
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" />
  Permalink  
Comments
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
good
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;
         }
     </script>
     .... 
     <input id="yourid" style="text-transform: uppercase" type="text" onkeypress="return noNumerics();"/>
 
[edit]Wrong name for function![/edit]
  Permalink  
v2
Comments
Member 9511889 at 22-Dec-12 7:43am
   
in asp.net 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)

  Print Answers RSS
0 OriginalGriff 6,189
1 Sergey Alexandrovich Kryukov 5,666
2 CPallini 4,810
3 George Jonsson 3,429
4 Gihan Liyanage 2,522


Advertise | Privacy | Mobile
Web04 | 2.8.140916.1 | Last Updated 24 Dec 2012
Copyright © CodeProject, 1999-2014
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