[CLOSED] Numberfield with separator returns min value when number with separator added

Page 1 of 3 123 LastLast
  1. #1

    [CLOSED] Numberfield with separator returns min value when number with separator added


    I have some troubles figuring this one out. I am sure it is just a little error in the config but I can't figure it out on my own. In the following example please insert once a number without a separator (returns the number) and once a number with the separator "." (returns min value) and click on the button.

    Thank you.

    <%@ Page Language="C#" %>
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    <script runat="server">
        protected void Page_Load(object sender, EventArgs e)
            if (!X.IsAjaxRequest)
                NumberField nfield = new NumberField
                    ID = "nfDouble",
                    FieldLabel = "enter double",
                    AllowDecimals = true,
                    DecimalSeparator = ".",
                    AllowBlank = false,
                    EmptyText = "needed",
                    HideTrigger = true
        public void showNumber()
            X.Msg.Alert("double", X.GetCmp<NumberField>("nfDouble", new NumberField.Config() { AllowDecimals = true, DecimalSeparator = "." }).Number.ToString()).Show();
    <!DOCTYPE html>
    <head id="Head1" runat="server">
        <form id="Form1" runat="server">
            <ext:ResourceManager ID="ResourceManager1" runat="server" Locale="de-CH" />
            <ext:Button runat="server" Text="show number" Handler="App.direct.showNumber();"></ext:Button>
    Last edited by Daniil; Jan 17, 2014 at 3:50 PM. Reason: [CLOSED]
  2. #2
    Hi @tMp,

    I cannot reproduce. I type "1.1" in the NumberField, then click the Button and see "1.1" in the alert box.

    1. Please post the rendered HTML (browser => Page Source).

    2. What Ext.NET version do you use?

    3. Is it reproducible in all the browsers?
  3. #3

    <!DOCTYPE html>
    <head id="Head1">
        <link type="text/css" rel="stylesheet" href="/KDM7/extjs/resources/ext_theme_classic/ext-theme-classic-all-embedded-css/ext.axd?v=30143" id="ext-theme" />
        <link type="text/css" rel="stylesheet" href="/KDM7/extnet/resources/css/extnet-all-embedded-css/ext.axd?v=30143" id="extnet-styles" />
        <script type="text/javascript" src="/KDM7/extjs/ext-all-js/ext.axd?v=30143"></script>
        <script type="text/javascript" src="/KDM7/extnet/extnet-all-js/ext.axd?v=30143"></script>
        <script type="text/javascript" src="/KDM7/extnet/locale/ext-lang-de-js/ext.axd?v=30143"></script>
        <script type="text/javascript">
            Ext.net.ResourceMgr.init({id:"ResourceManager1",aspForm:"Form1",appName:"KDM7"});Ext.onReady(function(){Ext.ns("App.direct");Ext.apply(App.direct, { showNumber:function(config){return Ext.net.DirectMethod.request("showNumber",Ext.applyIf(config || {}, {}));} });Ext.create("Ext.button.Button",{id:"ctl01",renderTo:"App.ctl01_Container",handler:function(){App.direct.showNumber();},text:"show number"});Ext.create("Ext.form.field.Number",{id:"nfDouble",renderTo:"App.nfDouble_Container",fieldLabel:"enter double",allowBlank:false,emptyText:"needed",hideTrigger:true,decimalSeparator:"."});});
        <form method="post" action="demo.aspx" id="Form1">
    <div class="aspNetHidden">
            <div id="App.ctl01_Container"></div>
        <div id="App.nfDouble_Container"></div></form>
    2) Version 2.4
    Ext.Net.dll -
    Ext.Net.Utilities.dll -
    Newtonsoft.Json.dll -
    Transformer.NET.dll -

    Yes, I tried the latest FF, Chrome and IE. Even the privacy modus where every addon should be deactivated. All of them give me "-1,79769313486232E+308" instead of your "1.1".
  4. #4
    Indeed, that is strange. I still cannot reproduce.

    Please check the submitted value in POST. What is there? It must be "1.1".

    Could you debug the NumberFieldBase' LoadPostData?
  5. #5
    Ok, I narrowed it down to only my development computer...

    When I ommit the config Decimalseparator="." everything works fine..

    When I enable it again:
    Firebug shows POST data "1.1". When I move the demo to the production server I get the correct result, even with my development computer.
    When I get the nfDouble post data like "Request.Form.GetValues..." I get the correct "1.1" too but
    X.GetCmp<NumberField>("nfDouble", new NumberField.Config() { AllowDecimals = true, DecimalSeparator = "." }).Number.ToString()
    X.GetCmp<NumberField>("nfDouble", new NumberField.Config() { DecimalSeparator = "." }).Number.ToString()
    they all give the same strange number when debugging.

    Do you have a hint, how (where) I can debug the NumberFieldBase' LoadPostData? I am still new to this...
  6. #6
    I guess the problem might be related to the locale of your OS.

    Quote Originally Posted by tMp View Post
    Do you have a hint, how (where) I can debug the NumberFieldBase' LoadPostData? I am still new to this...
    You need the Ext.NET sources. You can download them from SVN.

    1. Set a breakpoint within the NubmerFieldBase's LoadPostData method.
    2. Put your test sample into the Ext.Net.Examples project and run it.
  7. #7
    Ok. Thank you.

    So this is what I get...

    in LoadPostData in "(val != null)" I get an error at the "double number" when it does "this.CheckRange(val)". Until then val is still "1.1". The problem occurs in "CheckRange()" at the part where it does "(this.DecimalSeparator.isNotEmpty())". The this.DecimalSeparator is ",". Shouldnt it be "."?

    It throughs the error "Input string was not in a correct format" while doing "number = Double.Parse(value, nf);" because the DecimalSeparator is wrong.
  8. #8

    Please try to update Ext.Net.Utilities.dll to v2.4 Does it help?
  9. #9
    I am on version 2.4 now because I tried the demo in the version from the svn trunk today as you wished. I don't know how I could get any newer version of it.

    I don't know where it gets the wrong separator in
    number = Double.Parse(value, nf);
    with value = "1.1" and the separator value in nf of ",". Somehow it seems to be because of my special local setting but if I explicitly define "." I have now clue why it should take a separator value from somewhere else. It should just use ".".
  10. #10
    Please debug the getter of the NumberField's DecimalSeparator property. Maybe, it clarifies something.
Page 1 of 3 123 LastLast

Similar Threads

  1. numberfield control and decimal separator
    By cperriot in forum 1.x Help
    Replies: 0
    Last Post: Jul 17, 2012, 2:36 PM
  2. [CLOSED] Group separator property for number field
    By Daly_AF in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: May 11, 2012, 4:26 PM
  3. [CLOSED] How to allow thousand separator in ext:NumberField?
    By sailendra in forum 2.x Legacy Premium Help
    Replies: 1
    Last Post: May 07, 2012, 10:35 AM
  4. [CLOSED] Thousand separator in number Field
    By FpNetWorth in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Dec 28, 2010, 1:01 PM
  5. [CLOSED] Thousands separator in numberfield
    By 78fede78 in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Nov 08, 2010, 12:50 PM

Posting Permissions