hello,

I want client to enter Numbers only in mob no. TextBox and only Letters in Name TextBox so can anybody tell me how to do it ???

Hello all,

I find the solutions it's as follows:

Onkeypress
="if (event.keyCode >= 65 &amp;&amp; event.keyCode <= 122) event.returnValue = false"

just in case anyone needs.... it will accept special charactors u just need to change the code a bit.

Hey .. after you found the solution just please mark it as solved... so that everybody can easily refer.......

Thanks,
Phani

A better method is to use a RegularExpressionValidator. As post #3 suggests mark this post as solved.

user Regular Expression validator and type [1-9]*

it will allow only digits....hope it helps..

please let me know if i'm wrong...!

<input id="Text1" type="text" language="javascript"  onkeydown = "return isNumeric(event.keyCode);" onpaste = "return false;" />

<head runat="server">
    <title>Untitled Page</title>
    
     <script type ="text/javascript" language ="javascript">
         function isNumeric(keyCode)
        {
     return ((keyCode >= 48 && keyCode <= 57) || keyCode == 8)
        }

     </script>
     
</head>
<body>

k a couple of question... are you coding in vb or c# and are you using visual studeo.

- If using visual studio can you make a text box only take numeric values in the properties section. also... if you click on a text box... like you click on a submit button, you can make it do on entry or textchanged ... somethin like that. and when someone enters something you can have it validate as they enter information

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.