开发者

Currency validation issue

开发者 https://www.devze.com 2023-01-29 13:45 出处:网络
one of the validations I want is to make sure that the user does not enter an amount larger than smallmoey limits on SQL (214,748.00 approx). Below is my vali开发者_如何学Godation control but it is ki

one of the validations I want is to make sure that the user does not enter an amount larger than smallmoey limits on SQL (214,748.00 approx). Below is my vali开发者_如何学Godation control but it is kicking out entries that are smaller than that amount. for example, someone entered 1,821.00 and the control restricted it. Can someone see what I am doing wrong? Thanks.

<asp:CompareValidator ID="CompareValidator2" runat="server" 
                                        ErrorMessage="Rate cannot exceed 214,748.00" ControlToValidate="txtBudgetDetailRate" 
                                        Operator="LessThanEqual" Type="Double" ValueToCompare="214748.00">
</asp:CompareValidator>


Compare Validator checks the datatype before comparing the value. 1,821 is not a valid number. So, You might have got the error.

You can use Type="Currency" which enforces two decimal fixed precision. Remove that comma and enter value. It should work fine.

0

精彩评论

暂无评论...
验证码 换一张
取 消