format datetime in GridView ItemTemplate?

G

Guest

I can't figure out how to format a Label containing a datetime value in a
GridView .

<asp:TemplateField>
<ItemTemplate>
<asp:Label ID="JoinDate" runat="server" Text='<%# Eval("JoinDate")
%>' ></asp:Label>
</ItemTemplate>
</asp:TemplateField>
I use DataTextFormatString="{0:MMM yyyy}" in a DropDownList but this won't
work with the Label.

Thanks for any suggestions.
 
G

Guest

The data format string is passed as a second parameter to the Eval function
call Eval("JoinDate","{0:MMM yyyy}")
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top