Click here to Skip to main content
11,715,491 members (86,582 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 5:33am
24983691
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 Sergey Alexandrovich Kryukov 703
1 Richard MacCutchan 300
2 Maciej Los 259
3 ManasKumarM 130
4 Frankie-C 125
0 Sergey Alexandrovich Kryukov 785
1 CHill60 415
2 Richard MacCutchan 405
3 Maciej Los 389
4 OriginalGriff 320


Advertise | Privacy | Mobile
Web01 | 2.8.150901.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