This is a migrated thread and some comments may be shown as answers.

Range validation on numerictextbox

5 Answers 123 Views
NumericTextBox
This is a migrated thread and some comments may be shown as answers.
Fit2Page
Top achievements
Rank 2
Iron
Iron
Iron
Fit2Page asked on 24 Sep 2019, 09:38 AM

Hi,

 

Why would the following not accept the value 12.1 as valid?

 

 Dim tb As RadNumericTextBox = New RadNumericTextBox
                        plh.Controls.Add(tb)

                        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"
                        plh.Controls.Add(rv)

 

in the above the value 12.1 is not accepted as valid and should be I guess...

 

Marc

5 Answers, 1 is accepted

Sort by
0
Vessy
Telerik team
answered on 27 Sep 2019, 08:38 AM

Hi Marc,

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?

Regards,
Vessy
Progress Telerik

Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Fit2Page
Top achievements
Rank 2
Iron
Iron
Iron
answered on 30 Sep 2019, 08:07 AM

Hi Vessy,

 

Not sure what is happening here...I placed your testpage here:

 

http://qa.ontwikkelruimte.nl/numerictextbox_vb.aspx

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.

 

Marc

0
Vessy
Telerik team
answered on 03 Oct 2019, 08:39 AM

Hi Marc,

You can try setting explicitly the culture for the problematic page using the Page directive:

<%@ Page ... Culture="en-US" %>
or setting the Thread.CurrentThread.CurrentCulture in the code-behind - https://stackoverflow.com/a/7000587

 

Regards,
Vessy
Progress Telerik

Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Fit2Page
Top achievements
Rank 2
Iron
Iron
Iron
answered on 04 Oct 2019, 07:36 AM

Hi Vessy,

This works indeed. I find it strange though I set the globalization in the web.config already.

Thanks for your help.

Marc

0
Vessy
Telerik team
answered on 07 Oct 2019, 11:24 AM

Hi,

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.

Kind regards,
Vessy
Progress Telerik

Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
NumericTextBox
Asked by
Fit2Page
Top achievements
Rank 2
Iron
Iron
Iron
Answers by
Vessy
Telerik team
Fit2Page
Top achievements
Rank 2
Iron
Iron
Iron
Share this question
or