Click here to Skip to main content
15,891,136 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

How to avoid 0 or 0.00(Zero or Zero.zerozero) in textbox When save button?.This is amount column.It has decimal plces. Anybody tell me Validation controls or any.Plz Help me .
Posted
Updated 21-Dec-12 5:52am
v2
Comments
Akbar Ali Hussain 21-Dec-12 12:09pm    
Is the TextBox in a DataGrid?
24983 22-Dec-12 11:43am    
I want to only normal textbox

1 solution

If you are using ASP.NET forms, you can use the compare validator:
ASP.NET
<asp:TextBox id="txt1" runat="server" />
<asp:CompareValidator
  id="compval" 
  ControlToValidate="txt1"
  Type="Double" 
  Text="Validation Failed!" 
  Operator="GreaterThan"
  ValueToCompare = "0"
  runat="server" />



There are plenty of resources if you google for "asp.net comparevalidator"
 
Share this answer
 
Comments
24983 22-Dec-12 11:43am    
Thanks Barrow
Keith Barrow 23-Dec-12 16:03pm    
No problem.

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