Why would the following not accept the value 12.1 as valid?
Dim tb As RadNumericTextBox = New RadNumericTextBox
tb.ID = "check_" + e.Item.DataItem("id").ToString
tb.Type = NumericType.Number
tb.NumberFormat.DecimalSeparator = "."
Dim rv As RangeValidator = New RangeValidator
rv.ControlToValidate = tb.ID
rv.Type = ValidationDataType.Double
rv.MinimumValue = "12"
rv.MaximumValue = "13"
rv.ErrorMessage = "Invalid"
in the above the value 12.1 is not accepted as valid and should be I guess...
5 Answers, 1 is accepted
I tested the provided code but 12.1 is accepted as valid value at my end. For convenience I am attaching my test page to this reply - are you able to reproduce the same issue with it? If no, can you modify it up to a point where the problem occurs and send it back for a further examination?
Not sure what is happening here...I placed your testpage here:
And it is not validating correctly on my side.
I guess the number notation runs seperate from any user computer regional settings. When I use
tb.NumberFormat.DecimalSeparator = ","
then the validation is running OK on my side, despite I have set
<globalization uiCulture="en-US" culture="en-US" requestEncoding="UTF-8" responseEncoding="UTF-8" />
in my web.config
I wonder what is happening here...I hope you can shine some light on the case.
You can try setting explicitly the culture for the problematic page using the Page directive:
<%@ Page ... Culture="en-US" %>
This works indeed. I find it strange though I set the globalization in the web.config already.
Thanks for your help.
You are welcomeе, Marc. I am not sure why the web.config set culture is being ignored (probably some settings on application level are overwriting it), but I am glad that the suggested solution is working and the proper Culture is used on the page now.