aspx Tutorial

NET Articles,jQuery demo, with jQuery, online tutorial,Jquery, SilverLight, Javascript,,JSON, MVC,.NET Articles,demo, Web Services,
Advertise Here


Get our toolbar!


Posted by Aamir Hasan   on Friday, May 25, 2012 Total Views:  

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



  <%# 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

Add comment

  Country flag

  • Comment
  • Preview

Advertizement 1
Advertizement 2
Advertizement 3
Advertizement 4
Advertizement 5