I’m trying to insert date with “MM/dd/yyyy” Format into a date format field in a detailed view. But I am gettin error Message:
String was not recognized as a valid DateTime
I tried Like
<asp:TextBox ID="TextBox2" runat="server"
Text='<%# Bind("RenewalDate","{0,MM/dd/yyyy}")%>' ></asp:TextBox>
How can I insert date with format MM/dd/yyyy????
The format string is invalid. You need a colon after the placeholder instead of a comma:
That should fix the problem, assuming
RenewalDateis aDateTimecolumn. If it isn’t aDateTimecolumn, you’ll need to convert it before you apply the format:EDIT
To ensure that the input is valid, you can add compare and required field validators: