Click here to Skip to main content
15,896,359 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
hi friends
How can I Allow 5 digit before decimal point in text box.
Posted
Updated 14-Jan-16 23:56pm
v2
Comments
Sergey Alexandrovich Kryukov 15-Jan-16 22:02pm    
Bad idea...
—SA

To be honest, I wouldn't. You can do it, by either handling the TextChanged and KeyPress events and validating that way, or by handling the Validate event but...
I'd use a NumericUpDown control instead, and set a maximum of 99999.9999 and a minimum of 0. It's easier, it's more flexible, and it allows the user to enter as many leading zeros as he feels like, without allowing him to enter alpha characters.
 
Share this answer
 
HI
You can use regular expression for textbox

<asp:regularexpressionvalidator id="rgx" controltovalidate="txtControl" runat="server" xmlns:asp="#unknown">
ErrorMessage="*" Display="Dynamic" ValidationExpression="^[0-9]\d{0,5}(\.\d{1,2})?%?$">


use this
it will help you.
 
Share this answer
 

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