开发者

Currency validation issue

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜