Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: ASP.NET
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 21-Dec-12 5:33am
Smart83585
Edited 21-Dec-12 5:52am
v2
Comments
Akbar Ali Hussain at 21-Dec-12 12:09pm
   
Is the TextBox in a DataGrid?
santhosh19783 at 22-Dec-12 11:43am
   
I want to only normal textbox

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

If you are using ASP.NET forms, you can use the compare validator:
<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"
  Permalink  
Comments
santhosh19783 at 22-Dec-12 11:43am
   
Thanks Barrow
Keith Barrow at 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)

  Print Answers RSS
0 OriginalGriff 6,631
1 Sergey Alexandrovich Kryukov 6,345
2 CPallini 5,230
3 George Jonsson 3,574
4 Gihan Liyanage 2,522


Advertise | Privacy | Mobile
Web04 | 2.8.140921.1 | Last Updated 21 Dec 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100