Click here to Skip to main content
15,883,705 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi,

I have one gridview and last column as numeric columns.

I want to validate and gridview textbox should allow only numeric.

Ho to do this..?
Posted
Comments
Prerak Patel 25-Jul-11 2:45am    
Forms or web application?!
Sergey Alexandrovich Kryukov 25-Jul-11 2:53am    
Always tag it: WPF, Forms, APS.NET, what?
--SA

I found this[^] had been asked some time ago.
The solutions given there are fairly accurate and should help you out.
 
Share this answer
 
Comments
Uday P.Singh 25-Jul-11 2:55am    
my 5!
Abhinav S 25-Jul-11 5:24am    
Thank you Uday.
Suppose you expect the type int. The only reliable way to validate the property Text of the text box is to call int.TryParse(string).

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

Same thing goes for all other integer types.

—SA
 
Share this answer
 
Comments
Uday P.Singh 25-Jul-11 2:55am    
my 5!
Sergey Alexandrovich Kryukov 25-Jul-11 2:56am    
Thank you, Uday.
--SA

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