[CLOSED] Datefield / German error

Page 1 of 2 12 LastLast
  1. #1

    [CLOSED] Datefield / German error

    Hi

    Please have a look at this demo. Pre-requisit: The language has to be a german one, where March is like M?rz. The error only occurs when I select M?rz, every other Month without the ? has no problem at all. Is this a framework error?

    <%@ 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)
            {
                
            }
        }
        
        [DirectMethod]
        public void submitDate()
        {
            System.Data.SqlTypes.SqlDateTime dt = X.GetCmp<DateField>("dfTest", new DateField.Config() { Format = "MMM yyyy" }).SelectedDate;
            X.Msg.Alert("Date submited", dt.ToString()).Show();
        }
    
    </script>
    
    <!DOCTYPE html>
    
    <html>
    <head id="Head" runat="server">
        <title></title>
    
    </head>
    <body>
        <form id="Form" runat="server">
            <ext:ResourceManager ID="ResourceManager1" runat="server" Locale="de-CH" />
    
            <ext:DateField runat="server" ID="dfTest" AllowBlank="false" FieldLabel="Date" EmptyText = "required" Format = "MMM yyyy" Type="Month"></ext:DateField>
            <ext:Button runat="server" Text="Submit" OnClientClick="App.direct.submitDate()"></ext:Button>
                
        </form>
    </body>
    </html>
    thank you and best regards
    Last edited by Daniil; Mar 14, 2014 at 10:51 AM. Reason: [CLOSED]
  2. #2
    Hi @tMp,

    I see the following. Please clarify what Ext.NET version are you using?

    Click image for larger version. 

Name:	1.JPG 
Views:	42 
Size:	19.6 KB 
ID:	8131
    Last edited by Daniil; Mar 13, 2014 at 12:04 PM.
  3. #3
    That is correct what you see. Please select M?r and push the submit button. I always get an exception that the date must be between minValue and maxValue. But only when I select M?r, any other month works fine.

    I am still on 2.4 (because 2.5 breaks with a infinite scrolling list I have and I first have to fix some other errors because the app is already in use)
  4. #4
    Got it. There is inconsistency between .NET and ExtJS localizations.

    This returns "Mrz 2014".
    X.Msg.Alert("", DateTime.Now.ToString("MMM yyyy", new System.Globalization.CultureInfo("de"))).Show();
    It is why a March date cannot be deserialized.

    Please try this fix:
    Ext.onReady(function() {
        Ext.Date.getShortMonthName = function(month) {
            if (Ext.Date.monthNames[month] === "M?rz") {
                return "Mrz";
            }
    
            return Ext.Date.monthNames[month].substring(0, 3);
        };
    });
  5. #5
    In the demo it is working if I change the '?' to a '?' in M?rz but I am creating this window with a form by directmethod after a user button click and then it is not changing the short month name... I assume onReady doesn't work with the directmethod?
  6. #6
    Hmm, not sure what you exactly do. Please provide a test case.
  7. #7
    I can't reproduce it at the moment. If I do a demo everything works. The only difference I have is that in my app I have a masterfile and the onReady-Statement gets completely ignored. I pasted it where I have all my other javascript function and I even replaced the

    Ext.Date.getShortMonthName = function(month) {
            if (Ext.Date.monthNames[month] === "M?rz") {
                return "Mrz";
            }
     
            return Ext.Date.monthNames[month].substring(0, 3);
        };
    Part with a simple alert('test'); and even that doesn't get called... All the other functions are working flawlessly. Is there a specific place where it should be?
  8. #8
    Please post the Master Page. Maybe, I will be able to understand what is wrong.
  9. #9
    Meanwhile, I've committed the fix to the SVN trunk in the revision #5719. It will go to v2.5.1.
  10. #10
    Thank you very much!

    I got a master sample now where it ignores the onready:

    KDM7.master
    <%@ Master Language="C#" AutoEventWireup="true" CodeFile="KDM7.master.cs" Inherits="KDM7" %>
    
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    
    <!DOCTYPE html>
    
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        
        <ext:ResourceManager ID="ResourceManager" runat="server" Locale="de-CH"></ext:ResourceManager>
    
        <title></title>
    
        <asp:ContentPlaceHolder id="CPH_HEAD" runat="server"></asp:ContentPlaceHolder>
    
    </head>
    <body>
        <form id="form" runat="server">
    
            <asp:ContentPlaceHolder ID="CPH_BODY" runat="server">
    
            </asp:ContentPlaceHolder>
    
        </form>
    </body>
    </html>
    KDM7.master.cs
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    
    public partial class KDM7 : System.Web.UI.MasterPage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
    
        }
    }
    test.aspx
    <%@ Page Title="" Language="C#" MasterPageFile="~/KDM7.master" %>
     
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    
    <script runat="server">
     
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!X.IsAjaxRequest)
            {
                 
            }
        }
    
        [DirectMethod]
        public void createWindow()
        {
            // create sample data
            System.Data.DataTable dt = new System.Data.DataTable();
    
            System.Data.DataColumn dc = new System.Data.DataColumn("ID");
            dc.DataType = System.Type.GetType("System.String");
            dt.Columns.Add(dc);
            dc = new System.Data.DataColumn("VALUE");
            dc.DataType = System.Type.GetType("System.Int32");
            dt.Columns.Add(dc);
            System.Data.DataRow dr = dt.NewRow();
            dr[0] = "1";
            dr[1] = 100;
            dt.Rows.Add(dr); dr = dt.NewRow();
            dr[0] = "2";
            dr[1] = 75;
            dt.Rows.Add(dr); dr = dt.NewRow();
            dr[0] = "3";
            dr[1] = 55;
            dt.Rows.Add(dr);
            
            Window win = new Window
            {
                Title = "Date Test 1",
                ManageHeight = true,
                Items = {
                    new GridPanel {
                        AutoScroll = true,
                            MaxHeight = 500,
                            Store = {
                                new Ext.Net.Store {
                                    Model = {
                                        new Ext.Net.Model {
                                            Fields = {
                                                new Ext.Net.ModelField { Name = "ID", Type = Ext.Net.ModelFieldType.String },
                                                new Ext.Net.ModelField { Name = "VALUE", Type = Ext.Net.ModelFieldType.Int }
                                            }
                                        }
                                    },
                                    DataSource = dt
                                }
                            },
                            ColumnModel = {
                                Columns = {
                                    new Ext.Net.CommandColumn {
                                            Width = 30,
                                            Commands = { new GridCommand { Icon = Icon.BookEdit, CommandName = "edit" } },
                                            Listeners = { Command = { Handler = "App.direct.createWindow2()" }}
                                    },
                                    new Ext.Net.Column { Text = "Value", DataIndex = "VALUE", Width = 100 }
                                }
                            }
                    }
                }
            };
            win.Render();
        }
         
        [DirectMethod]
        public void createWindow2()
        {
            Window win = new Window
            {
                Title = "Date Test 2",
                Width = 300,
                Items = {
                    new DateField { FieldLabel = "Date", Format = "MMM yyyy", Type = DatePickerType.Month }
                }
            };
            win.Render();
        }
     
    </script>
    
    <asp:Content ID="Content1" ContentPlaceHolderID="CPH_HEAD" Runat="Server">
    
        <script>
    
            Ext.onReady(function () {
                Ext.Date.getShortMonthName = function (month) {
                    if (Ext.Date.monthNames[month] === "M?rz") {
                        return "Mrz";
                    }
    
                    return Ext.Date.monthNames[month].substring(0, 3);
                };
            });
    
        </script>
    
    </asp:Content>
    <asp:Content ID="Content2" ContentPlaceHolderID="CPH_BODY" Runat="Server">
    
         <ext:Button ID="Button1" runat="server" Text="Create Window 1" OnClientClick="App.direct.createWindow()"></ext:Button>
    
    </asp:Content>
Page 1 of 2 12 LastLast

Similar Threads

  1. DateField display error in explorer 9
    By Fabrizio in forum 1.x Help
    Replies: 2
    Last Post: Jun 05, 2011, 5:00 PM
  2. [CLOSED] German Flag
    By csharpdev in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Jan 11, 2011, 1:20 PM
  3. [CLOSED] [1.0] DateField error
    By PoloTheMonk in forum 1.x Legacy Premium Help
    Replies: 5
    Last Post: Dec 01, 2010, 6:03 AM
  4. Replies: 2
    Last Post: Jan 04, 2010, 5:37 PM
  5. [CLOSED] DateField error at runtime
    By methode in forum 1.x Legacy Premium Help
    Replies: 3
    Last Post: Nov 24, 2008, 1:11 PM

Posting Permissions