May 22, 2015, 8:55 AM
[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 = "3.4.1.1")
Here the definition in the aspx
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
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.
BUT
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.
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 = "3.4.1.1")
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">
<Listeners>
<Click Handler=" #{DirectMethods}.ResetEventReportDates(); " />
</Listeners>
</ext:LinkButton>
<ext:DateField ID="dfEventsStartDate" runat="server" FieldLabel="Date_From" EnableKeyEvents="true" Width="190" LabelWidth="50" >
</ext:DateField>
Here my server side direct method [DirectMethod]
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.
BUT
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]