Textbox contain only number ie: it may be decimal , comma within the numbers

No.of Views3294
Bookmarked0 times
Downloads 
Votes0
By  Troy   On  15 Feb 2010 23:02:08
Tag : ASP.NET , Validation Controls
Textbox contain only number ie: it may be decimal , comma within the numbers
emailbookmarkadd commentsprint

Images in this article missing? We recently lost them in a site migration. We're working to restore these as you read this. Should you need an image in an emergency, please contact us at info@codegain.com

 

Introduction


Here we have to discuss the Regular expression which accept only numbers and it might be also

decimal and also the comma inbetween numbers..

Technologies:

.Net 2.0

Language:

C# and VB.NET


Prerequisite

.NET Framework 2.0


Visual Studio 2005


Implementation


Valid Format: 123-45-6789




ValidationExpression="^[+-]?(?:\d+\,?\d*|\d*\.?\d+)[\r\n]*$"


I have placed the html code place it on your new Default.aspx and runt the project and make sure it will accept only numbers


Match Case : Only numbers , Decimal numbers , (,) inbetween number


Ex: 5425

52.210

54,254,25


Non- Match:


247Mani

Rd245

Thank you

Venkat

 
Sign Up to vote for this article
 
About Author
 
Troy
Occupation-Not Provided
Company-Not Provided
Member Type-Junior
Location-Not Provided
Joined date-10 Jun 2009
Home Page-Not Provided
Blog Page-Not Provided
 
 
Other popularSectionarticles
Comments
By:KashifDate Of Posted:4/5/2011 3:11:47 AM
First is easy
I think the first Query is easy to understand.
Leave a Reply
Title:
Display Name:
Email:
(not display in page for the security purphase)
Website:
Message:
Please refresh your screen using Ctrl+F5
If you can't read this number refresh your screen
Please input the anti-spam code that you can read in the image.
^ Scroll to Top