?
Solved

Unable to change date format for text in the Eval function in asp:Label

Posted on 2011-10-14
4
Medium Priority
?
285 Views
Last Modified: 2012-05-12
I`m trying to change the format of a label that is getting its value from an Eval expression, e.g. Eval("DateModified"). See attached screenshot.

Peter ASPxLabel_DateFormatError
0
Comment
Question by:pbc83
  • 3
4 Comments
 
LVL 11

Expert Comment

by:rajvja
ID: 36968835
<%# EVAL(ds,fldname).ToString("yyyy-MM-dd").ToString() %>

try this way
0
 

Assisted Solution

by:pbc83
pbc83 earned 0 total points
ID: 36971225
Sorry rajvja that solution doesn't work.
0
 

Accepted Solution

by:
pbc83 earned 0 total points
ID: 36971508
I found the solution:

<asp:Label ID="ModifiedLabel" runat="server" Text= '<%# DataBinder.Eval(Container.DataItem, "DateModified", "{0:MM/dd/yyyy}") %>' />

This works!

Peter
0
 

Author Closing Comment

by:pbc83
ID: 36991314
Solution works.
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
Suggested Courses

864 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question