aspx Tutorial

.NET Articles,jQuery demo, asp.net with jQuery, online tutorial,Jquery, SilverLight, Javascript, asp.net,JSON, MVC,.NET Articles,demo, Web Services, .NET articles, Sharepoint 2010, visual studio 2010,Aamir Hasan,IT, Building Your First Web Application Project
Advertise Here

Toolbar

Get our toolbar!

Advertize



Posted by Aamir Hasan   on Thursday, May 24, 2012 Total Views:  

The following code example demonstrates how to format a date in DataBinder.Eval in asp.net controls such as GridView, DetailsView, DataList, Repeater etc. DataBinder.Eval method is used to bind data on runtime and returns result as a string.

Syntax

 

  <%# DataBinder.Eval(Container.DataItem, "expression", "format")%>

 

You can use following code to format mm/dd/yyyy Date:

  <%# DataBinder.Eval(Container.DataItem, "datetime", "{0: MM/dd/yyyy}")%>

 

As you have seen that DataBinder.Eval third parameter option that format date as a string.

Note:Use only eval method when string formatting is required because it can cause performance too slow.

Protected by Copyscape Online Plagiarism Tool

Comments (1) -

ice  machine
ice machine People's Republic of China
9/10/2012 10:40:59 PM #

I enjoy what you guys are up too. This sort of clever work and exposure! Keep up the great works guys I've included you guys to blogroll.


http://www.chinaicemaker.com

hermes bags
hermes bags People's Republic of China
9/13/2012 1:02:33 AM #

But professional are mortally of kinsfolk peripheral competent -- online besides on system corners -- who are looking considering folks transcendent agog on buying a Birkin to scam.

BEATS BY DRE STUDIO
BEATS BY DRE STUDIO United States
9/13/2012 7:54:21 PM #

This small device would really great because they need it for<a href="www.cheapbeatsbydrem.org/beats-by-dre-studio-outlet-12.html"><strong>; BEATS BY DRE STUDIO </strong></a>    relaxation, we all know that listening music would be the best way for relaxation

Add comment

  Country flag

biuquote
  • Comment
  • Preview
Loading

Advertizement 1
Advertizement 2
Advertizement 3
Advertizement 4
Advertizement 5