Empty NumberField returns minimal value

  1. #1

    Empty NumberField returns minimal value

    Hello

    I wanted to use for a non mandatory field a number field, the problem is, when the number field is empty, what is allowed, it returns the minimal value instead of the an empty value/string, I'm doing something wrong or this is from design?

    <%@ Page Language="C#" AutoEventWireup="true" %>
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <script runat="server">
    public void Click(object sender,EventArgs e)
    {
        Label1.Text=NumberField1.Text;
    }
    </script>
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title></title>
    </head>
    <body>
        <form id="form1" runat="server">
        <div>
            <ext:ResourceManager ID="ResourceManager1" runat="server" />
            <ext:NumberField ID="NumberField1" runat="server" AllowBlank="true" MinValue="10" MaxValue="20" />
            <ext:Label ID="Label1" runat="server" />
            <ext:Button ID="Button1" runat="server" Text="Submit">
                <DirectEvents>
                    <Click OnEvent="Click" />
                </DirectEvents>
            </ext:Button>
        </div>
        </form>
    </body>
    </html>
  2. #2
    I got the same error when using datefiel, it turns the datetime.Minvalue,and give the SqlDateTime overflow. Must be between 1/1/1753 12:00:00 AM and 12/31/9999 11:59:59 PM.
    assigning to null this datetime.Minvalue,I solve the problem
  3. #3
    Yes, but you don't have anymore the check for a minimal value.
  4. #4
    Quote Originally Posted by Spamme View Post
    Yes, but you don't have anymore the check for a minimal value.
    how come? I still get the same error?
  5. #5
    If you remove the MinValue attribute from the NumberField the returned value is an empty string for Text and null for Value.
  6. #6
    I have tested it with ext.net 2.1 and upgrading to 2.2 solves the problem.

Similar Threads

  1. Replies: 0
    Last Post: Mar 14, 2013, 3:37 PM
  2. Replies: 2
    Last Post: Feb 07, 2013, 11:40 AM
  3. Empty NumberField
    By yyyhxm1 in forum 1.x Help
    Replies: 3
    Last Post: Aug 23, 2010, 2:50 AM
  4. Replies: 0
    Last Post: Aug 04, 2010, 8:20 PM
  5. [CLOSED] [1.0] MultiSelect returns empty on Postback
    By randy85253 in forum 1.x Legacy Premium Help
    Replies: 6
    Last Post: Nov 12, 2009, 12:55 AM

Tags for this Thread

Posting Permissions