944,045 Members | Top Members by Rank

Ad:
  • ASP.NET Discussion Thread
  • Unsolved
  • Views: 6455
  • ASP.NET RSS
Jul 23rd, 2007
0

text box validataion

Expand Post »
how to make a validation like vb in asp.net? I want to make a text box should only accept numeric values....

samy
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
samycbe is offline Offline
4 posts
since Jul 2007
Jul 25th, 2007
0

Re: text box validataion

hi,

To validate the numeric in the TextBox use


RegularExpressionValidator control
In Properties

Specify the control which control to validate in ControlToValidate Property.

In Text Property Specify any Error Message.




regards
shailu
Reputation Points: 34
Solved Threads: 10
Junior Poster
manoshailu is offline Offline
105 posts
since Jun 2007
Jul 25th, 2007
0

Re: text box validataion

Click to Expand / Collapse  Quote originally posted by samycbe ...
how to make a validation like vb in asp.net? I want to make a text box should only accept numeric values....

samy
friend may i know what language you are using
you want tovalidate that on client side or server side
Reputation Points: 10
Solved Threads: 0
Newbie Poster
vinod varma is offline Offline
3 posts
since Jul 2007
Jul 25th, 2007
0

Re: text box validataion

hi,

Its a server side validation control, this control can be used in VB or C# and one more thing u have to mainly specify the Validation Expression in the control property.

Numeric Validation : \d {3,5} -----> d -Numeric Checking, {} - Size
Character Validation : \D {5,10} -----> D - Character Validation, {} - Size.


Regards
Shailu.
Reputation Points: 34
Solved Threads: 10
Junior Poster
manoshailu is offline Offline
105 posts
since Jun 2007
Jul 25th, 2007
0

Re: text box validataion

Hi,

I would suggest you to use "MaskedEdit" control from ajax toolkit. here is the link.

http://ajax.asp.net/ajaxtoolkit/Mask...askedEdit.aspx
Reputation Points: 10
Solved Threads: 1
Light Poster
kedar_challa is offline Offline
47 posts
since Nov 2005
Jul 27th, 2007
0

Re: text box validataion

If the intention is only to make the textbox accept only numeric values, just very simply use the Isnumeric function.

that is
ASP.NET Syntax (Toggle Plain Text)
  1.  
  2. if not Isnumeric(textbox.text) then
  3. 'do stuff like forcing retyping of content
  4. end if
  5.  
Hope this helps.
Reputation Points: 215
Solved Threads: 6
Posting Whiz in Training
jamello is offline Offline
219 posts
since Oct 2006
Apr 10th, 2009
0

Re: text box validataion

HI,
HOPE THE BELOW LINK WILL HELP READERS A LOT FOR CROSS-BROWSER NUMERIC VALIDATION:
http://shawpnendu.blogspot.com/2009/...isnumeric.html
Reputation Points: 26
Solved Threads: 44
Posting Whiz in Training
mail2saion is offline Offline
247 posts
since Apr 2009
Apr 10th, 2009
0

Re: text box validataion

mail2saion, many thanks for bumping this thread to promote your blog.
Reputation Points: 232
Solved Threads: 137
Practically a Master Poster
buddylee17 is offline Offline
665 posts
since Nov 2007
Apr 12th, 2009
0

Re: text box validataion

Click to Expand / Collapse  Quote originally posted by samycbe ...
how to make a validation like vb in asp.net? I want to make a text box should only accept numeric values....

samy
Hi,
First of all you need validation for textbox and you want user to enter only numeric values. So rather than allowing user to enter something and check it whether it is numeric or not is not good approach. I believe prevention is better than cure.

So you can Use FilterTextboxExtender that comes with AjaxToolkit. Please have a look at this demo

I hope this will solve your problem. You can use other tools also, they are very useful.

Happy Programming!!
nil
Reputation Points: 10
Solved Threads: 0
Light Poster
nil is offline Offline
30 posts
since Nov 2006

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in ASP.NET Forum Timeline: Web form
Next Thread in ASP.NET Forum Timeline: populate email with data from database





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC