MinValue when try to select a datefield value

  1. #1

    MinValue when try to select a datefield value

    when i try to get selected date of a datefield, the selected value always is 01/01/0001, in aspx page, but in ascx all its ok.

    Mi aspx page code:

    <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Login.aspx.cs" Inherits="appSigmaSafi.Login" %>
    
    <!DOCTYPE html >
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title></title>
    </head>
    
    <body><form runat="server"  id="test">
    
       <ext:Window ID="Window1" runat="server" Closable="true" Resizable="false" Height="500"
            Icon="Lock" Title="Login" Draggable="false" Width="350" Modal="true" BodyPadding="5"
            Layout="Form">
           
            <Items>
                <ext:DateField ID="dtLiquiFecha" runat="server" Format="dd/MM/yyyy"  FieldLabel="Fecha" Padding="5">
                </ext:DateField>
            </Items>
            <Buttons>
                
                <ext:Button ID="Button2" runat="server" Text="Submit">
                    <DirectEvents>
                        <Click OnEvent="test">
                        </Click>
                    </DirectEvents>
                </ext:Button>
            </Buttons>
        </ext:Window>
    </form>
     
    </body>
    </html>
    Mi directMethod code:
    
     public void test(object sender,DirectEventArgs  e){
    
                
                X.Msg.Alert("TEST",dtLiquiFecha.SelectedDate  ).Show();
                
     }
    i hope your help.
  2. #2
    You need to escape / symbol

    Format="dd\/MM\/yyyy"
  3. #3
    thax for the fast answer,

    this is mi new page code:

    <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Login.aspx.cs" Inherits="appSigmaSafi.Login" %>
     
    <!DOCTYPE html >
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title></title>
    </head>
     
    <body><form runat="server"  id="test">
     
       <ext:Window ID="Window1" runat="server" Closable="true" Resizable="false" Height="500"
            Icon="Lock" Title="Login" Draggable="false" Width="350" Modal="true" BodyPadding="5"
            Layout="Form">
            
            <Items>
                <ext:DateField ID="dtLiquiFecha" runat="server" Format="dd\/MM\/yyyy"  FieldLabel="Fecha" Padding="5">
                </ext:DateField>
            </Items>
            <Buttons>
                 
                <ext:Button ID="Button2" runat="server" Text="Submit">
                    <DirectEvents>
                        <Click OnEvent="test">
                        </Click>
                    </DirectEvents>
                </ext:Button>
            </Buttons>
        </ext:Window>
    </form>
      
    </body>
    </html>
    continue with the same problem.

    Click image for larger version. 

Name:	test.png 
Views:	108 
Size:	20.6 KB 
ID:	4763
  4. #4
    What CurrentCulture on the server?
  5. #5
    i initialize currentCulture with this base class inherit on all mi pages.

    I tried with "en-US" and "en-PE"

    public class BasePage : System.Web.UI.Page
        {
           //private const String m_DefaultCulture = "en-PE";
            private const String m_DefaultCulture = "en-US";
    
            protected  override void InitializeCulture() { 
            
             String culture= Convert.ToString(Session["MyCulture"]);
    
            if (String.IsNullOrEmpty(culture)) 
                culture = m_DefaultCulture;
    
    
            Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture(culture);
    
            Thread.CurrentThread.CurrentUICulture = new CultureInfo(culture);
    
            base.InitializeCulture();
            }
  6. #6
    I cannot reproduce the problem
    Here is my test case
    <%@ Page Language="C#" %>
    
    
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    <!DOCTYPE html >
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title></title>
    
    
        <script runat="server">
            //private const String m_DefaultCulture = "en-PE";
            private const String m_DefaultCulture = "en-US";
    
    
            protected override void InitializeCulture()
            {
    
    
                String culture = Convert.ToString(Session["MyCulture"]);
    
    
                if (String.IsNullOrEmpty(culture))
                {
                    culture = m_DefaultCulture;
                }
    
    
    
    
                System.Threading.Thread.CurrentThread.CurrentCulture = System.Globalization.CultureInfo.CreateSpecificCulture(culture);
    
    
                System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo(culture);
    
    
                base.InitializeCulture();
            }
    
    
            public void test(object sender, DirectEventArgs e)
            {
    
    
    
    
                X.Msg.Alert("TEST", dtLiquiFecha.SelectedDate).Show();
    
    
            }
        </script>
    </head>
    <body>
        <form runat="server">
        <ext:ResourceManager runat="server" />
        <ext:Window ID="Window1" runat="server" Closable="true" Resizable="false" Height="500"
            Icon="Lock" Title="Login" Draggable="false" Width="350" Modal="true" BodyPadding="5"
            Layout="Form">
            <Items>
                <ext:DateField ID="dtLiquiFecha" runat="server" Format="dd\/MM\/yyyy" FieldLabel="Fecha"
                    Padding="5">
                </ext:DateField>
            </Items>
            <Buttons>
                <ext:Button ID="Button2" runat="server" Text="Submit">
                    <DirectEvents>
                        <Click OnEvent="test">
                        </Click>
                    </DirectEvents>
                </ext:Button>
            </Buttons>
        </ext:Window>
        </form>
    </body>
    </html>
  7. #7
    i think i found the error, but i need someone help.

    i mean, in mi basePage, i have this methods

    
      protected void  insertarResourceManager() {
    
                ResourceManager res = new ResourceManager
                {
                    DirectMethodNamespace = "Sigma",
                    ID="generalResource"
    
                };
              
                Page.Controls.Add(res);
                
    
            }
    
            protected override void OnLoad(EventArgs e)
            {
    
    
                insertarResourceManager();
                base.OnLoad(e);
            }
    when i use a local resourceManager, the selectedvalue date its ok, but when i try to implement a inherit resourceManager, i have this problem. Any advice?, is better use local Resource manager ?

Similar Threads

  1. Replies: 0
    Last Post: Jun 02, 2012, 2:51 PM
  2. DateField select problem
    By m2276699 in forum 1.x Help
    Replies: 1
    Last Post: Nov 04, 2011, 12:26 AM
  3. Replies: 3
    Last Post: May 06, 2010, 12:48 PM
  4. Replies: 1
    Last Post: Dec 26, 2009, 7:59 AM
  5. Replies: 1
    Last Post: May 24, 2009, 5:12 PM

Posting Permissions