Forums

 
ForumForumMainstream Foru...Mainstream Foru...BugsBugsCalendar ModuleCalendar Module
Previous Previous
 
Next Next
New Post
 1/20/2006 7:20 PM
 

When I call the calendar module, I'm getting the following error in day and week view:

String was not recognized as a valid DateTime.

I'm getting the following error when I click the month view:

String was not recognized as a valid DateTime.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.FormatException: String was not recognized as a valid DateTime.

Source Error:

Line 103:				DateTime dtDAY_END   = dtDAY_START.AddDays(1);
Line 104:				// 09/27/2005 Paul.  System.Data.DataColumn.Expression documentation has description how to define dates and strings. 
Line 105:				vwMain.RowFilter = "   DATE_START >= #" + dtDAY_START.ToString() + "# and DATE_START <  #" + dtDAY_END.ToString() + "#" + ControlChars.CrLf
Line 106:				                 + "or DATE_END   >= #" + dtDAY_START.ToString() + "# and DATE_END   <= #" + dtDAY_END.ToString() + "#" + ControlChars.CrLf
Line 107:				                 + "or DATE_START <  #" + dtDAY_START.ToString() + "# and DATE_END   >  #" + dtDAY_END.ToString() + "#" + ControlChars.CrLf;

Source File: C:\Inetpub\wwwroot\SplendidCRM\Calendar\MonthView.ascx.cs    Line: 105

Stack Trace:

[FormatException: String was not recognized as a valid DateTime.]
   System.DateTimeParse.GetDayOfNNY(DateTimeResult result, DateTimeRawInfo raw, DateTimeFormatInfo dtfi) +202
   System.DateTimeParse.ProcessTerminaltState(Int32 dps, DateTimeResult result, DateTimeRawInfo raw, DateTimeFormatInfo dtfi) +142
   System.DateTimeParse.Parse(String s, DateTimeFormatInfo dtfi, DateTimeStyles styles) +488
   System.DateTime.Parse(String s, IFormatProvider provider, DateTimeStyles styles) +30
   System.DateTime.Parse(String s, IFormatProvider provider) +11
   System.Data.ConstNode..ctor(ValueType type, Object constant, Boolean fParseQuotes) +891
   System.Data.ExpressionParser.Parse() +870
   System.Data.DataExpression..ctor(String expression, DataTable table, Type type) +149
   System.Data.DataView.set_RowFilter(String value) +151
   SplendidCRM.Calendar.MonthView.ctlCalendar_DayRender(Object source, DayRenderEventArgs e) in C:\Inetpub\wwwroot\SplendidCRM\Calendar\MonthView.ascx.cs:105
   System.Web.UI.WebControls.Calendar.OnDayRender(TableCell cell, CalendarDay day) +143
   System.Web.UI.WebControls.Calendar.RenderDays(HtmlTextWriter writer, DateTime firstDay, DateTime visibleDate, CalendarSelectionMode selectionMode, Boolean buttonsActive) +1366
   System.Web.UI.WebControls.Calendar.Render(HtmlTextWriter writer) +960
   System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +243
   ASP.MonthView_ascx.__Render__control1(HtmlTextWriter __output, Control parameterContainer) +200
   System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +27
   System.Web.UI.Control.Render(HtmlTextWriter writer) +7
   System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +243
   System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +72
   System.Web.UI.HtmlControls.HtmlForm.RenderChildren(HtmlTextWriter writer) +44
   System.Web.UI.HtmlControls.HtmlForm.Render(HtmlTextWriter output) +262
   System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +243
   _ASP.Month_aspx.__Render__control1(HtmlTextWriter __output, Control parameterContainer) +152
   System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +27
   System.Web.UI.Control.Render(HtmlTextWriter writer) +7
   System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +243
   System.Web.UI.Page.ProcessRequestMain() +1926


Version Information: Microsoft .NET Framework Version:1.1.4322.2300; ASP.NET Version:1.1.4322.2300

 

 

New Post
 1/21/2006 12:56 PM
 

The problem is that .ToString() is not converting the date to a format that DataView.RowFilter understands.  This is actually a common problem with date handling that is typically solved by using Parameter objects instead of string concatenation.  However, since RowFilter does not support Paramters, we must code the concatenation in a format understood by all cultures.  The trick is to specify the format as Year/Month/Day,

   ToString("yyyy/MM/dd HH:mm:ss")

The following files needed to be fixed:

DayGrid.ascx.cs
MonthView.ascx.cs
SharedGrid.ascx.cs
WeekGrid.ascx.cs

 

New Post
 6/30/2006 1:23 PM
 
This format gives me problems as well. I am using Italian culture. Do you have any other solution.

Thanks

Alberto
New Post
 7/14/2006 1:56 PM
 

We will have to research this issue more.  What can you tell me about the languages of the Microsoft products?  Are you running the English or Italian version of Windows?

 

New Post
 7/24/2006 7:29 AM
 

My system is in English, Paul.

Alberto

Previous Previous
 
Next Next
ForumForumMainstream Foru...Mainstream Foru...BugsBugsCalendar ModuleCalendar Module