DateField always return minValue if the default format changed

  1. #1

    DateField always return minValue if the default format changed



    When changing DateField.Format property to any format other than the default one 'm/d/Y' the DateField.SelectedDate always returns the DateTime min value "1/1/0001 12:00:00 AM"

    <%@ Page Language="C#" AutoEventWireup="true" %>
    <%@ Register Assembly="Coolite.Ext.Web" Namespace="Coolite.Ext.Web" TagPrefix="ext" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
    <title></title>
    <script runat="server" type="text/C#">
    protected void Button1_Click(object sender, EventArgs e)
    {
    Response.Write("Default: " + DefaultFormat.SelectedDate);
    Response.Write("</br>");
    Response.Write("Y-m-d: " + OtherFormat.SelectedDate);
    }
    </script>
    </head>
    <body>
    <form id="form1" runat="server">
    <ext:ScriptManager ID="ScriptManager1" runat="server">
    </ext:ScriptManager>
    <ext:Panel ID="Panel1" runat="server" Height="300" Title="Title">
    <Body>
    <ext:DateField ID="DefaultFormat" runat="server">
    </ext:DateField>
    <ext:DateField ID="OtherFormat" Format="Y-m-d" runat="server">
    </ext:DateField>
    <asp:Button ID="Button1" runat="server" Text="Button" &#111;nclick="Button1_Click" />
    </Body>
    </ext:Panel>
    </form>
    </body>
    </html>
  2. #2

    RE: DateField always return minValue if the default format changed

    Oops I found the solution here http://forums.ext.net/showthread.php...ight=DateField

    The issue is

    Hi Timothy,


    The Format property should be set with a .NET DateTime format specifier. The Toolkit will automatically convert the .NET format into the PHP/Unix format required by ExtJS.


    Example



    <DIV class=forum-code><ext:DateField ID="MyDate" runat="server" Format="MMMM d, yyyy" /></PRE>


    Hope this helps.

Similar Threads

  1. Replies: 17
    Last Post: Jun 04, 2012, 10:56 AM
  2. Replies: 0
    Last Post: Jun 02, 2012, 2:51 PM
  3. [CLOSED] NumberField MinValue return null value
    By Aurelio in forum 2.x Legacy Premium Help
    Replies: 2
    Last Post: Mar 22, 2012, 1:10 PM
  4. Replies: 4
    Last Post: Aug 06, 2009, 2:08 PM
  5. [CLOSED] Return to default styles
    By tansu in forum 1.x Legacy Premium Help
    Replies: 3
    Last Post: Aug 01, 2009, 11:16 AM

Posting Permissions