Friday, December 24, 2010

Formatting date values shown in label control inside a Gridview

Reference: Set Date Format in Gridview
To format date as short date format of a label control inside a template field use Bind() as shown below:
1:  <ItemTemplate>  
2:    <asp:Label id="lblDateRec" runat="server" Text='<%#   
3:    Bind("GeneratedDateRec", "{0:MM/dd/yyyy}") %>'></asp:Label>  
4:  </ItemTemplate>  


Post a Comment