November Happy Hour will be moved to Thursday December 5th.
November Happy Hour will be moved to Thursday December 5th.
What property type is your "Date"? If it is a DateTime, you cannot make a substring on it since substring is a method on a string.
To get a property value as a DateTime you need to cast it, for example: (DateTime)page["Date"]
See http://world.episerver.com/Articles/Items/Best-Coding-Practices/ for some best practices about casting Properties and preparing for null values.
If you want to convert a DateTime to a string you need to perform a .toString() on it. Since there are ways to format a string on the DateTime.toString() method I think it would be better to use it instead of performing .toString().SubString();
See http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx and http://msdn.microsoft.com/en-us/library/az4se3k1.aspx for more information about DateTime string formats
Hi!
I'm using a repeater and the following in markup:
<%# ((EPiServer.Core.PageData)Container.DataItem)["Date"]%>
I really would like to shorten the date with a substring method. I just don't get it to work... How can I do this?