Thursday, September 10, 2015

Make an Eval in a DevExpress ASPxGridView format a datetime in a manner other than the ugly default.

<dx:GridViewDataColumn FieldName="MyDate" VisibleIndex="7">
   <DataItemTemplate>
      <%# Eval("MyDate") %>
   </DataItemTemplate>
</dx:GridViewDataColumn>

 
 

...needs to instead become...

<dx:GridViewDataColumn FieldName="MyDate" VisibleIndex="7">
   <DataItemTemplate>
      <%# Eval("MyDate", "{0:M/d/yyyy}") %>
   </DataItemTemplate>
</dx:GridViewDataColumn>

No comments:

Post a Comment