Reputation: 319
I have a gridview with column "Date", I want to print it in this format MM dd, yyyy DDDD.
I have this on my .aspx class:
<asp:TemplateField HeaderText="Date" SortExpression="MyDateTime">
<ItemTemplate>
<asp:Label Text="<%#Item.MyDateTime.Value.ToString("MM dd, yyyy DDDD")%>"
runat="server" />
</ItemTemplate>
</asp:TemplateField>
But I keep getting this error: Parser Error The server tag is not well formed.
I can't see which tag is not well formed. If i don't include "MM dd, yyyy DDDD", the code does not have this error, but does not print the way I wanted it to be.
Upvotes: 2
Views: 177
Reputation: 8818
I would suggest using single quotes like:
<asp:Label Text='<%#Item.MyDateTime.Value.ToString("MM dd, yyyy DDDD")%>' runat="server" />
Upvotes: 2