Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > Other .NET > General .NET
| Search | Today's Posts | Mark Forums Read
General .NET For general discussion of MICROSOFT .NET topics that don't fall within any of the other .NET forum subcategories or .NET language forums.  If your question is specific to a language (C# or Visual Basic) or type of application (Windows Forms or ASP.Net) try an applicable forum category. ** PLEASE BE SPECIFIC WITH YOUR QUESTION ** When posting here, provide details regarding the Microsoft .NET language you are using and/or what type of application (Windows/Web Forms, etc) you are working in, if applicable to the question. This will help others answer the question without having to ask.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the General .NET section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 2nd, 2004, 06:19 AM
Authorized User
 
Join Date: Jul 2004
Location: Delhi, Delhi, India.
Posts: 36
Thanks: 0
Thanked 0 Times in 0 Posts
Default validation problem

I want to validate a particulear textbox,i.e
my app. has a online form,and i want that,in a textbox user can unable to enter only numeric digits (from 0 to 9 only).
and also same for alphabetic(from A to z only)for another textbox.

abhinavjain
__________________
abhinavjain
 
Old August 2nd, 2004, 10:39 AM
Friend of Wrox
 
Join Date: Jul 2004
Location: Tehran, , Iran.
Posts: 623
Thanks: 0
Thanked 1 Time in 1 Post
Default

for ASP.NET application use RangeValidator.
for Windows application go http://p2p.wrox.com/topic.asp?TOPIC_ID=16247

--------------------------------------------
Mehdi.
 
Old August 5th, 2004, 01:07 AM
Friend of Wrox
 
Join Date: Oct 2003
Location: Chennai, TamilNadu, India.
Posts: 326
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to Santhi Send a message via MSN to Santhi
Default

Call this javascript function on onKeyPress event of the textbox..

function DisAllowNumbers(){
    if (window.event.keyCode >= 48 && window.event.keyCode <= 57){
    window.event.returnValue=false;
    }
}
function DisAllowAlphabets(){
    //This is for Capital letters
    if (window.event.keyCode >= 65 && window.event.keyCode <= 90){
    window.event.returnValue=false;
    }
    //This is for small letters
    if (window.event.keyCode >= 97 && window.event.keyCode <= 122){
    window.event.returnValue=false;
    }
}

 
Old August 5th, 2004, 05:33 AM
Friend of Wrox
 
Join Date: Jul 2004
Location: Tehran, , Iran.
Posts: 623
Thanks: 0
Thanked 1 Time in 1 Post
Default

Dear Santhi
RangeValidator does all of them for you,No need for writing javascript.

--------------------------------------------
Mehdi.:)
 
Old August 5th, 2004, 05:57 AM
Friend of Wrox
 
Join Date: Oct 2003
Location: Chennai, TamilNadu, India.
Posts: 326
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to Santhi Send a message via MSN to Santhi
Default

Using javascript is also one way of doing..

 
Old August 5th, 2004, 07:33 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: , , USA.
Posts: 1,110
Thanks: 0
Thanked 3 Times in 3 Posts
Default

You could also try using a Regular Expression Validator.

 
Old August 5th, 2004, 02:32 PM
Friend of Wrox
 
Join Date: Jul 2004
Location: Tehran, , Iran.
Posts: 623
Thanks: 0
Thanked 1 Time in 1 Post
Default

Dear Santhi,
I meant RangeValidator will write such javascript for you,no need writing javascript.
>>Using javascript is also one way of doing...
what was the meaning of this sentence? ;))

--------------------------------------------
Mehdi.:)




Similar Threads
Thread Thread Starter Forum Replies Last Post
validation problem Ashleek007 JSP Basics 1 June 18th, 2007 01:16 AM
Validation problem monika.vasvani ASP.NET 1.0 and 1.1 Professional 1 November 25th, 2006 01:44 PM
Interesting validation problem jacob ASP.NET 1.0 and 1.1 Professional 5 February 16th, 2006 07:16 PM
Validation and Insert problem addos Beginning PHP 0 January 17th, 2005 06:50 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.