View Full Version : [CLOSED] Text of DateField showing 1/1/0001

Jun 09, 2014, 4:38 PM
Hi, I am using a DateField that works well when selecting from date selector but it is not returning anything when user enters free text.

<ext:DateField ID="CalcJobPricingDate" runat="server" Name="CalcJobPricingDate" HideMode="Display" AllowBlank="true" Hidden="true" />

(The control is hidden at first but then I unhide it when user clicks a button).

Anyways, this works:

CalcJobPricingDate.SelectedDate.ToShortDateString( )

But sometimes our user needs to enter a free text, in a different format, for example: 20140101 (YYYYMMDD format).
In those cases I just need the strong from "text" property.

When I check the text property I get 1/1/0001:


How can I make the DateField return what was entered in the text box in code behind?

Jun 09, 2014, 5:47 PM
Hi @Ariel,

You can use


As an alternative approach, you can register AltFormats for a DateField. There is a big set of default AltFormats.

For "20140101" it should look like this.

<ext:DateField ID="DateField1" runat="server" AltFormats="yyyyMMdd" />

Then you'll be able to use a DataField's SelectedDate.