This is a migrated thread and some comments may be shown as answers.

DataFormatString with eval

1 Answer 647 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Tina
Top achievements
Rank 1
Tina asked on 24 Sep 2012, 10:47 AM
I'm using this code. I want to show only date part. But it is stored as date time in db?How can we apply formatting when using eval
<telerik:GridTemplateColumn>
                  <ItemTemplate>
                  <asp:Label ID="Label1" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "Date of Arrival")%>'></asp:Label>
   </ItemTemplate>
                  </telerik:GridTemplateColumn>

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 24 Sep 2012, 11:47 AM
HI,

Try setting the DataFormatString as shown below.
aspx:
<telerik:GridTemplateColumn>
    <ItemTemplate>
          <asp:Label ID="Label1" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "Date of arrival", "{0:dd-MM-yyyy}") %>'></asp:Label>
   </ItemTemplate>
</telerik:GridTemplateColumn>

Thanks,
Shinu.
Tags
General Discussions
Asked by
Tina
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Share this question
or