Calendar control returning wrong format

Discussion in 'ASP .Net' started by GFro, Oct 26, 2004.

  1. GFro

    GFro Guest

    I have a calendar page that returns a date to a textbox on the parent
    page. It is returning the wrong format on the deployment server. On
    the development server the calendar returns to textbox in the
    mm/dd/yyyy format. I created a deployment package and installed the
    program on another server and it also returned the correct mm/dd/yyyy
    format. Recently I got complaints saying that the format changed to
    mm-dd-yyyy format. This mm-dd-yyyy format is invalid and I throw an
    error messsage to the user.

    Has anything changed on Windows 2000 recently that could have affected
    this? I'm guessing this problem started a week or two ago. IT still
    works fine on the development server.



    I have attached the code below for the calendar and the icon that
    calls the calendar below. Any help would greatly be appreciated.







    Here is the code for the calendar page.


    <%@ Page language="c#" Codebehind="Calendar.aspx.cs"
    AutoEventWireup="false" Inherits="WCMS.Calendar" %>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
    <HTML>
    <HEAD>
    <title>Calendar</title>
    <script runat="server">

    private void Calendar1_SelectionChanged(object sender,
    System.EventArgs e)
    {
    string strjscript = "<script language=javascript>";
    strjscript = strjscript + "window.opener." +
    HttpContext.Current.Request.QueryString["FormName"] + ".value = '" +
    Calendar1.SelectedDate.ToString("MM/dd/yyyy") + "';window.close();";
    strjscript = strjscript + "</script" + ">";

    Literal1.Text = strjscript;

    }
    private void Calendar1_DayRender(object sender,
    System.Web.UI.WebControls.DayRenderEventArgs e)
    {
    if (e.Day.Date == DateTime.Today)
    {
    e.Cell.BackColor = System.Drawing.Color.LightGray;
    }

    }

    </script>
    <meta name="GENERATOR" Content="Microsoft Visual Studio 7.0">
    <meta name="CODE_LANGUAGE" Content="C#">
    <meta name="vs_defaultClientScript" content="JavaScript">
    <meta name="vs_targetSchema"
    content="http://schemas.microsoft.com/intellisense/ie5">
    </HEAD>
    <body>
    <form id="Calendar" method="post" runat="server">
    <asp:calendar id="Calendar1" Width="120"
    OnDayRender="Calendar1_DayRender"
    OnSelectionChanged="Calendar1_SelectionChanged" Height="60"
    ForeColor="#000080" BorderColor="#000000" FirstDayOfWeek="Monday"
    BackColor="#ffffff" SelectionMode="Day"
    DayNameFormat="FirstTwoLetters" ShowTitle="True" Runat="server">
    <TitleStyle BackColor="#000080" ForeColor="#ffffff" />
    <NextPrevStyle BackColor="#000080" ForeColor="#ffffff" />
    <OtherMonthDayStyle ForeColor="#c0c0c0" />
    </asp:calendar><BR>
    <asp:Literal ID="Literal1" Runat="server"></asp:Literal>
    </form>
    </body>
    </HTML>

    Here is the code that calls the calendar page.

    <A id="A1" style="Z-INDEX: 165; LEFT: 608px; POSITION: absolute; TOP:
    251px" href="javascript:calendar_window=window.open('/WCMS/calendar.aspx?formname=Form1.oshipdate_box','calendar_window','width=173,height=208');calendar_window.focus()"
    runat="server">
    <IMG id="cal1" height="16" src="/WCMS/icon-calendar.gif"
    width="24" border="0" runat="server"></A>
     
    GFro, Oct 26, 2004
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Shevek
    Replies:
    3
    Views:
    6,130
    Shevek
    Jun 23, 2004
  2. Koen Hoorelbeke

    date-format in mobile calendar control ?

    Koen Hoorelbeke, Nov 15, 2003, in forum: ASP .Net Mobile
    Replies:
    6
    Views:
    215
    Earl Beaman[MS]
    Dec 2, 2003
  3. Shevek
    Replies:
    0
    Views:
    429
    Shevek
    Jun 23, 2004
  4. Jon Prisbe

    Calendar control in a datagrid returns wrong date

    Jon Prisbe, Mar 31, 2006, in forum: ASP .Net Web Controls
    Replies:
    2
    Views:
    229
    Jon Prisbe
    Apr 3, 2006
  5. Lee Falataco
    Replies:
    2
    Views:
    368
    Bullschmidt
    Aug 10, 2004
Loading...

Share This Page