473,326 Members | 2,813 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

DataList\FormatDate

gh
Below is the code from an aspx file for the datalist

<ItemTemplate>
<p>Company:&nbsp;
<asp:Label id="UserFieldLabel" runat="server" width="450px"
text='<%# Eval("UserField") %>'></asp:Label>&nbsp;Project:
<asp:Label id="PrjNameLabel" runat="server" width="253px"
text='<%# Eval("PrjName") %>'></asp:Label>&nbsp;Project Date:
<asp:Label id="ProjectDateLabel" runat="server" text='<%#
Eval("ProjectDate") %>'></asp:Label>Address:
Where do I put the format code to have project date display as
mm/dd/yyyy? Is {d: mm/dd/yyyy} the correct code for this?

TIA
Oct 1 '07 #1
1 3821
Hi,

you can use format string with Eval

<asp:Label id="ProjectDateLabel" runat="server" text='<%#
Eval("ProjectDate","{0:mm/dd/yyyy}") %>'>
--
Teemu Keiski
AspInsider, ASP.NET MVP
http://blogs.aspadvice.com/joteke
http://teemukeiski.net
"gh" <gh@att.netwrote in message
news:ut**************@TK2MSFTNGP03.phx.gbl...
Below is the code from an aspx file for the datalist

<ItemTemplate>
<p>Company:&nbsp;
<asp:Label id="UserFieldLabel" runat="server" width="450px" text='<%#
Eval("UserField") %>'></asp:Label>&nbsp;Project:
<asp:Label id="PrjNameLabel" runat="server" width="253px" text='<%#
Eval("PrjName") %>'></asp:Label>&nbsp;Project Date:
<asp:Label id="ProjectDateLabel" runat="server" text='<%#
Eval("ProjectDate") %>'></asp:Label>Address:
Where do I put the format code to have project date display as mm/dd/yyyy?
Is {d: mm/dd/yyyy} the correct code for this?

TIA

Oct 2 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.