Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Sep 23, 2011 08:22 PM by sjnaughton
Sep 23, 2011 06:03 PM|LINK
I need to change the display date format of all the dates in my Dynamic Data app. I'm trying to modify the DateTime field template to always return in short date format ("d"). I don't need globalization or anything sophisticated. Changing the
return Literal1 to return Literal1.ToString("d") gives an error"No overload for method 'ToString' takes 1 arguments".
Sep 23, 2011 06:10 PM|LINK
Because you are converting string into date. that why it is giving error
you need to convert like
Sep 23, 2011 08:22 PM|LINK
You will need to do this in the OnDataBinding event of the field template and use the FiledValue property
Literal1.Text = ((DateTime)FieldValue).ToString("d");
Or you can do that using the [DataTypeAttabute on each DataTime field in the metadata.