Click here to Skip to main content
11,490,003 members (52,467 online)
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 6:33am
24983680
Edited 21-Dec-12 6: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 Sergey Alexandrovich Kryukov 610
1 Andy Lanng 233
2 OriginalGriff 208
3 Maciej Los 160
4 Sascha Lefèvre 160
0 Sergey Alexandrovich Kryukov 9,608
1 OriginalGriff 8,475
2 Sascha Lefèvre 3,419
3 Maciej Los 3,106
4 Richard Deeming 2,370


Advertise | Privacy | Mobile
Web01 | 2.8.150520.1 | Last Updated 21 Dec 2012
Copyright © CodeProject, 1999-2015
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