Quantcast
Channel: Web Forms
Viewing all articles
Browse latest Browse all 23244

ASP compare validatory type=currency

$
0
0

I have 3 currency type inputs in a form. Here is the code:

When I change the amount in one of the fields and update, the compare validator kicks off on existing valid data also and gives the error message. I have to edit the field removing 2 extra decimal places.

<table width="100%" border="1" cellpadding="15" ><tr align="left"><td><asp:Label ID="label4" runat="server" Text="Cash Amount:" /><asp:TextBox ID="dsCash" runat="server" /><asp:CompareValidator ID="cv1" ControlToValidate="dsCash" runat="server" ErrorMessage="Amount must be Numeric" Operator="DataTypeCheck" Type="Double"  /></td></tr><tr align="left"><td><asp:Label ID="Label5" runat="server" Text="Check Amount:" /><asp:TextBox ID="dsChk" runat="server" /><asp:CompareValidator ID="cv2" ControlToValidate="dsChk" runat="server" ErrorMessage="Amount must be Numeric" Operator="DataTypeCheck" Type="Currency"  /><br /><asp:Label ID="Label7" runat="server" Text="Check Details:" /><asp:TextBox ID="dsChkDetail" runat="server" /></td></tr><tr align="left"><td><asp:Label ID="Label6" runat="server" Text="Credit Card Amount:" /><asp:TextBox ID="dsCC" runat="server" /><asp:CompareValidator ID="cv3" ControlToValidate="dsCC" runat="server" ErrorMessage="Amount must be Numeric" Operator="DataTypeCheck" Type="Currency"    /><br /><asp:Label ID="Label8" runat="server" Text="Credit Card Details:" /></td></tr><tr><td><asp:Button ID="BtnPrev" runat="server" Text="< Prev.Day" CausesValidation="false" OnClick="loadPREV" OnClientClick="javascript:return PrevDate();" /><asp:Button ID="BtnUpdate" runat="server" Text="Update"   OnClick="updateDD" /><asp:Button ID="BtnCancel" runat="server" Text="Cancel"   CausesValidation="false" OnClick="loadCURR" /><asp:Button ID="BtnNext" runat="server" Text="> Next.Day" CausesValidation="false" OnClick="loadNEXT" OnClientClick="javascript:return NextDate();" /></td></tr>

I tried changing the dataTypeCheck to decimal, still same issue.

Please advise,

ASP.NET 4.0  c#


Viewing all articles
Browse latest Browse all 23244

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>