Submit and retrieve RadNumerticTextBox values

2 posts, 0 answers
  1. Jesús
    Jesús avatar
    53 posts
    Member since:
    Oct 2007

    Posted 05 Mar 2014 Link to this post

    We are updating our UI for ASP.NET AJAX from an old version of 2011 to the last one. I have to note we have our system in Spanish.

    All is going right, but we have a couple of problems with some controls: RadDatePicker and RadNumericTextBox.

    The problem with RadDatePicker is resolved, but I'm not able to resolve the problem with RadNumericTextBox.

    When we click the submit button in a web form, we retrieve the data from Request.Form. In our old version, obviously, is going correctly, but when we try to do the same with the current version, data is retrieved "different".

    For example, the number 5.661000. Always is displayed in Spanish culture (so, this is 5,661 -in Spain, the comma is the decimal separator-), and when we submit the form in 2011 version the retrieved value is 5.661, but in 2014 the retrieved value is 5,661000, so when we try to work with this value we've got an exception.

    I attach some images illustrating this. RadNumericTextBox shows how the control is displayed in all cases, 2011 request shows the value retrieved in old version and 2011 control shows the different properties values of the control; the same things with 2014 images. Note the value we get in Request.Form with current version is like the DisplayText property of the control :O
  2. Konstantin Dikov
    Konstantin Dikov avatar
    2466 posts

    Posted 10 Mar 2014 Link to this post

    Hello Jesús,

    Thank you for contacting Telerik Support.

    Over the years we have introduced some changes to the RadNumericTextBox control, one of which is related to the issue you are referring to. Please note that this was done for optimization purposes only. With versions prior to Q1 2012, the RadNumericTextBox was generating four input elements and currently it renders only two. This change have huge impact on the performance, but as you have found out yourself, it has some downside regarding a custom logic used with previous versions.

    Now, if you need to get the entered value on different from the Page's Init event, you could use the RadNumericTextBox control Value property, which return a double? type, which could be used for your custom logic. However, if you need that value in the Page's Init event handle you could use a culture depending parsing, like shown bellow:
    protected void Page_Init(object sender, EventArgs e)
        string value = Request.Form["RadNumericTextBox1"];
        var culture = new CultureInfo("es-ES");
        var typeConverter = TypeDescriptor.GetConverter(typeof(double?));
        double? doubleValue = (double?)typeConverter.ConvertFromString(
    Hope that helps.

    Konstantin Dikov

    DevCraft Q1'14 is here! Watch the online conference to see how this release solves your top-5 .NET challenges. Watch on demand now.

Back to Top