Why can't I check the values ​​with the $ character in it?

I use CompareValidator to validate user input on one of my forms, but for some reason it will not allow me to enter a dollar sign.

According to MSDN , the currency data type in the comparison validator allows you to:

A type of decimal data that can contain currency symbols.

I use the control below to verify:

<asp:CompareValidator ID="vld_Cash" runat="server" ControlToValidate="CashTextBox" Type="Currency" Operator="DataTypeCheck" ValidationGroup="vld_Update" ErrorMessage="The value entered for 'Cash' must be in a number format.  Do NOT include dollar signs.  Examples: 500 or 500.00" />

I also added the following to my web.config to be sure:

<globalization culture="en-US" uiCulture="en-US"/>

But he still says that any input with $ in it is invalid. Did I miss something?

+3
source share
1 answer

The last comment in this thread shows why and gives you some ideas:

Currency validator

Article dedicated to this:

ASP.Net: ( RegularExpressionValidator).

0

Source: https://habr.com/ru/post/1763681/


All Articles