Hi all , How can we restrict user to enter integer alone in textbox (like using ascii code restriction in keypress event in VB).
since keypress event not available for textbox property in asp.net 1.1 how can we overcome this problem
I'm sure there is some JavaScript out there that will do this for you. I know that there is an extender that comes with the ASP.NET AJAX package that filters text boxes for you and will not accept user input that isn't a number... but to use you will require .NET Framework 2 or higher to run it...and of course download ASP.NET Ajax.
If you are restricted to only using VB, I'd suggest letting the user enter whatever they would like to and then displaying an error message stating that they are only allowed to enter numbers as a valid input value.
You could also use a RegularExpressionValidator that checks to see if numbers have been entered into the Textbox. This will not prevent the user from entering other values in the textbox but will catch the error before it is submitted to the server
Remember that the RegularExpressionValidator (as well as the other validation tools that come with Visual Studio) use JavaScript to do the checking for you.
Hope this helps
-Frinny