I have a template filed as listed below. I need to display millisecond part of DateTime also.
I have read about the dateValue.ToString("fff")
format in http://msdn.microsoft.com/en-us/library/bb882581.aspx How to: Display Milliseconds in Date and Time Values
.
What is the best way to display it in Template Field with Eval?
CODE
<asp:TemplateField HeaderText="Event Time">
<ItemTemplate>
<asp:Literal ID="ltlTime" runat="server" Text='<%# Eval("LastChangeTime") %>' ></asp:Literal>
<asp:HiddenField ID="hdnMilliSeconds" runat="server" Value='<%# ((DateTime)Eval("LastChangeTime")).ToString("fff") %>' />
</ItemTemplate>
</asp:TemplateField>
Reference:
use
in your SQL query. and then access "LastChangeTime" in eval
Thanks to @kj nap. I figured it out. For the benefit of others I will post it here:
I used following
CODE
CODE BEHIND
Try this