[CLOSED] Ext.net 1.7 Datefield SetDate not working

  1. #1

    [CLOSED] Ext.net 1.7 Datefield SetDate not working

    Hi everybody,
    I have a big issue on setting a datetime in an ext:datefield.

    I want to set a value from serverside in a directmethod to avoid javascript datetime manipulation since I don't want to include additional datetime js libraries. Ext.Date is not available in the ext.js I'm using (Ext.Version = "")

    Here the definition in the aspx

    <ext:LinkButton ID="btnReportEvents" runat="server" Text="Eventi" Icon="ReportGo"
                                            Width="150" Margins="5 5 5 5" IconAlign="Left">
                                                <Click Handler=" #{DirectMethods}.ResetEventReportDates(); " />
    <ext:DateField ID="dfEventsStartDate" runat="server"  FieldLabel="Date_From" EnableKeyEvents="true" Width="190" LabelWidth="50"  >
    Here my server side direct method

            public void ResetEventReportDates()
                SetValueTo_DateField(dfEventsStartDate, DateTime.Now.AddDays(-7));
            public static void SetValueTo_DateField(DateField ctrl, object data)
                DateTime dt_to_set = DateTime.MinValue;
                if(data != null && data != DBNull.Value)
                    dt_to_set = Convert.ToDateTime(data);
                ctrl.SelectedDate = dt_to_set;

    Additional notes.

    The Text displayed in the datefield change, but I cannot get it when I want to get it back from serverside with this code

            public DateTime? GetValueFrom_DateField(DateField ctrl)
                DateTime? r;
                if (ctrl.Value == null)
                    return null;
                r = Convert.ToDateTime(ctrl.Value);
                if (r.Value < System.Data.SqlTypes.SqlDateTime.MinValue.Value)
                    return null;
                return r;

    If from the javascript console I change it with dfEventsStartDate.setValue(new Date()) it's the same, I cannot read the value from server side.


    When I change it from the javascript console with dfEventsStartDate.setValue(new Date(2000,1,1)) then from server side I can read it.

    Thanks for your help,
    have a good day.
    Last edited by Daniil; May 30, 2015 at 2:10 PM. Reason: [CLOSED]
  2. #2

    Please post simple test case which demonstrates your scenario. We have to run it and check (test case must be runnable on our side)

Similar Threads

  1. [CLOSED] DateField : Validation Not Working
    By matrixwebtech in forum 2.x Legacy Premium Help
    Replies: 4
    Last Post: Apr 09, 2015, 9:22 AM
  2. MinDate Property Does not working in DateField
    By anil420anil420@gmail.com in forum 1.x Help
    Replies: 8
    Last Post: Feb 15, 2012, 5:41 AM
  3. [1.0] DateField.Format not working
    By nextSTEP in forum 1.x Help
    Replies: 4
    Last Post: Nov 18, 2010, 10:18 AM
  4. [CLOSED] DateField not working when using custom format
    By alexp in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Apr 22, 2009, 10:33 AM
  5. Datefield Readonly not working
    By EzaBlade in forum 1.x Help
    Replies: 0
    Last Post: Feb 12, 2009, 9:28 AM

Posting Permissions