Click here to Skip to main content
15,888,281 members
Please Sign up or sign in to vote.
2.00/5 (2 votes)
See more:
hi,
I have a gridview in which editable textbox are present.I am supposed to allow only numbers like 1 or 0.12345 with max 5 decimal point places. Please help me



thanks in advance
Posted
Comments
bbirajdar 23-Aug-12 5:05am    
Ok.. So whats the problem ?

1 solution

You should have a look at the ASP.NET Validators, e.g. the RangeValidator or RegularExpressionValidator:

http://msdn.microsoft.com/en-us/library/aa479013.aspx[^]

In-depth information about Validation in ASP.NET
http://msdn.microsoft.com/en-us/library/aa479045.aspx#aspplusvalid_clientside[^]
 
Share this answer
 
v2
Comments
Member 8459400 23-Aug-12 5:29am    
but using RegularExpressionValidator how would i restrict d users for this format 0.XXXXX? and i dnt want to display a message...when the user types any invaild number it should not be seen in the screen.tats my requirement
Legor 23-Aug-12 5:41am    
With regular expressions you can restrict the input to pretty any kind of format. Of course you'll have to learn regular expressions for that, which i'd advice since they are helpful in a lot of cases.

But if i understand you right you like to validate the input before sending it to the server? In that case you'll need some client side validation which can be done e.g. with JavaScript. I updated the answer with another link to a very informative article about different ways of validation in ASP.NET. Have a look at that.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900