I'm sure this is a piece of cake, but I'm really struggling with something that seems trivial.
I need to check the entered text of the text field on the submit form and check if it is within the required range (I tried checking the range, but for some reason this does not work, so I'm trying to do this on the server side).
What I want to do:
Get the entered value (for example, 0.02), replace the commas and periods, convert them to decimal (or double or equivalent) and check if it is between 0.10 and 35000.00.
Here is what I still have:
string s = txtTransactionValue.Text.Replace(",", string.Empty).Replace(".", string.Empty); decimal transactionValue = Decimal.Parse(s); if (transactionValue >= 0.10M && transactionValue <= 35000.00M)
If I pass 0.02 to the above, transactionValue is 2. I want to save the value as 0.02 (i.e. do not make any changes to it) - 100.00 - 100.00, 999.99 - 999.99)
Any ideas?
Thanks in advance, Brett
source share