Range validation on numerictextbox

6 posts, 0 answers
  1. Fit2Page
    Fit2Page avatar
    442 posts
    Member since:
    Feb 2007

    Posted 24 Sep Link to this post

    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

  2. Vessy
    Admin
    Vessy avatar
    2067 posts

    Posted 27 Sep Link to this post

    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.
  3. Fit2Page
    Fit2Page avatar
    442 posts
    Member since:
    Feb 2007

    Posted 30 Sep in reply to Vessy Link to this post

    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

  4. Vessy
    Admin
    Vessy avatar
    2067 posts

    Posted 03 Oct Link to this post

    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.
  5. Fit2Page
    Fit2Page avatar
    442 posts
    Member since:
    Feb 2007

    Posted 04 Oct in reply to Vessy Link to this post

    Hi Vessy,

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

    Thanks for your help.

    Marc

  6. Vessy
    Admin
    Vessy avatar
    2067 posts

    Posted 07 Oct Link to this post

    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.
Back to Top