Not sure if this is a bug or I have made a mess of something somewhere. So appologies if it is down to something daft I have done!
I have a Datepicker in a document type that is giving me a yellow screen of death with the error "String was not recognized as a valid DateTime."when I attempt to get a preview of a document using the preview button in umbraco.
The problem does not occur if I view the live published page.
I am using an umbraco:Item tag in my template to pull the date from the doc type. From playing round with it, the problem starts happening when I set the property formatAsDate="true" on the umbraco:Item tag.
I got around it by creating an .net usercontrol to do the date formatting and calling it from an umbraco macro.
So I am just wondering if am just missing something obvious, or there is problem using the formatAsDate property in conjunction with the document preview?
Thanks
Jim
Info:
Umbraco 4.0.2.1 Vista IIS7 MySQL 5.1.34
Yellow Screen:
String was not recognized as a valid DateTime.
body {font-family:"Verdana";font-weight:normal;font-size: .7em;color:black;}
p {font-family:"Verdana";font-weight:normal;color:black;margin-top: -5px}
b {font-family:"Verdana";font-weight:bold;color:black;margin-top: -5px}
H1 { font-family:"Verdana";font-weight:normal;font-size:18pt;color:red }
H2 { font-family:"Verdana";font-weight:normal;font-size:14pt;color:maroon }
pre {font-family:"Lucida Console";font-size: .9em}
.marker {font-weight: bold; color: black;text-decoration: none;}
.version {color: gray;}
.error {margin-bottom: 10px;}
.expandable { text-decoration:underline; font-weight:bold; color:navy; cursor:hand; }
Server Error in '/' Application.
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:
An unhandled exception was generated during the execution of the
current web request. Information regarding the origin and location of the
exception can be identified using the exception stack trace below.
Usercontrol added with id 'ImageFromMediaByAlias_5'
0.339344106583379
0.000402
macro.loadControlProperties
Property added 'ImageAlias' with value 'newsArticleMainImage'
0.339486093902996
0.000142
macro.loadControlProperties
Property added 'DefaultImageNodeID' with value '1087'
0.339598608202998
0.000113
item
Start parsing 'newsArticleTitle'
0.339628151063892
0.000030
item
Done parsing 'newsArticleTitle'
0.339655528845146
0.000027
item
Start parsing 'newsArticleDate'
0.339676271704923
0.000021
Unhandled Execution Error
String was not recognized as a valid DateTime. at
System.DateTimeParse.Parse(String s, DateTimeFormatInfo dtfi, DateTimeStyles
styles) at System.Convert.ToDateTime(String value) at
umbraco.item.parseItem(IDictionary attributes) at
umbraco.item..ctor(IDictionary elements, IDictionary attributes) at
umbraco.presentation.templateControls.ItemRenderer.GetFieldContents(Item
item) at
umbraco.presentation.templateControls.ItemRenderer.ParseMacros(Item
item) at umbraco.presentation.templateControls.ItemRenderer.Init(Item
item) at umbraco.presentation.templateControls.Item.OnInit(EventArgs
e) at System.Web.UI.Control.InitRecursive(Control namingContainer) at
System.Web.UI.Control.InitRecursive(Control namingContainer) at
System.Web.UI.Control.InitRecursive(Control namingContainer) at
System.Web.UI.Control.InitRecursive(Control namingContainer) at
System.Web.UI.Control.InitRecursive(Control namingContainer) at
System.Web.UI.Control.InitRecursive(Control namingContainer) at
System.Web.UI.Control.InitRecursive(Control namingContainer) at
System.Web.UI.Control.InitRecursive(Control namingContainer) at
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint,
Boolean includeStagesAfterAsyncPoint)
The only downside to this solution is that the preview doesn't process the inline XSLT properly, so the date isn't being displayed in the preview. It's not a huge issue for me, but if someone knows how to fix this (without a custom .net method), please let me know!
FormatAsDate causing error in page preview
Not sure if this is a bug or I have made a mess of something somewhere. So appologies if it is down to something daft I have done!
I have a Datepicker in a document type that is giving me a yellow screen of death with the error "String was not recognized as a valid DateTime."when I attempt to get a preview of a document using the preview button in umbraco.
The problem does not occur if I view the live published page.
I am using an umbraco:Item tag in my template to pull the date from the doc type. From playing round with it, the problem starts happening when I set the property formatAsDate="true" on the umbraco:Item tag.
I got around it by creating an .net usercontrol to do the date formatting and calling it from an umbraco macro.
So I am just wondering if am just missing something obvious, or there is problem using the formatAsDate property in conjunction with the document preview?
Thanks
Jim
Info:
Umbraco 4.0.2.1
Vista
IIS7
MySQL 5.1.34
Yellow Screen:
String was not recognized as a valid DateTime. body {font-family:"Verdana";font-weight:normal;font-size: .7em;color:black;} p {font-family:"Verdana";font-weight:normal;color:black;margin-top: -5px} b {font-family:"Verdana";font-weight:bold;color:black;margin-top: -5px} H1 { font-family:"Verdana";font-weight:normal;font-size:18pt;color:red } H2 { font-family:"Verdana";font-weight:normal;font-size:14pt;color:maroon } pre {font-family:"Lucida Console";font-size: .9em} .marker {font-weight: bold; color: black;text-decoration: none;} .version {color: gray;} .error {margin-bottom: 10px;} .expandable { text-decoration:underline; font-weight:bold; color:navy; cursor:hand; }
Server Error in '/' Application.
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:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
Version Information: Microsoft .NET Framework Version:2.0.50727.4062; ASP.NET Version:2.0.50727.3601
Request Details
Trace Information
String was not recognized as a valid DateTime.
at System.DateTimeParse.Parse(String s, DateTimeFormatInfo dtfi, DateTimeStyles styles)
at System.Convert.ToDateTime(String value)
at umbraco.item.parseItem(IDictionary attributes)
at umbraco.item..ctor(IDictionary elements, IDictionary attributes)
at umbraco.presentation.templateControls.ItemRenderer.GetFieldContents(Item item)
at umbraco.presentation.templateControls.ItemRenderer.ParseMacros(Item item)
at umbraco.presentation.templateControls.ItemRenderer.Init(Item item)
at umbraco.presentation.templateControls.Item.OnInit(EventArgs e)
at System.Web.UI.Control.InitRecursive(Control namingContainer)
at System.Web.UI.Control.InitRecursive(Control namingContainer)
at System.Web.UI.Control.InitRecursive(Control namingContainer)
at System.Web.UI.Control.InitRecursive(Control namingContainer)
at System.Web.UI.Control.InitRecursive(Control namingContainer)
at System.Web.UI.Control.InitRecursive(Control namingContainer)
at System.Web.UI.Control.InitRecursive(Control namingContainer)
at System.Web.UI.Control.InitRecursive(Control namingContainer)
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
Control Tree
Session State
Application State
Request Cookies Collection
Response Cookies Collection
Headers Collection
Response Headers Collection
Form Collection
Querystring Collection
Server Variables
Microsoft .NET Framework Version:2.0.50727.4062; ASP.NET Version:2.0.50727.3601
Do you still get the error after you publish, then previewing?
Dan
Thanks for the reply.
Yes, I still get the error after publishing, then clicking preview.
I also tried a republish entire site and still get the error, when clicking preview.
I'm also getting a server error in the preview when using the formatAsDate="true" attribute:
I worked around this by using inline XSLT:
The only downside to this solution is that the preview doesn't process the inline XSLT properly, so the date isn't being displayed in the preview. It's not a huge issue for me, but if someone knows how to fix this (without a custom .net method), please let me know!
is working on a reply...