Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8870043
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T17:37:30+00:00 2026-06-14T17:37:30+00:00

I have a template filed as listed below. I need to display millisecond part

  • 0

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:

  1. Eval/Bind TimeOfDay property without milliseconds?
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T17:37:31+00:00Added an answer on June 14, 2026 at 5:37 pm

    Thanks to @kj nap. I figured it out. For the benefit of others I will post it here:

    I used following

     '<%# ((DateTime)Eval("LastChangeTime")).ToString("MM/dd/yyyy hh:mm:ss.fff tt") %>' 
    

    CODE

      <asp:TemplateField HeaderText="Application ID">
                            <ItemTemplate>
                                <asp:Literal ID="ltlApplicationID" runat="server" Text='<%# Eval("ApplicationID") %>'></asp:Literal>
                                <asp:HiddenField ID="hdnLastChangeTime" runat="server" Value='<%# ((DateTime)Eval("LastChangeTime")).ToString("MM/dd/yyyy hh:mm:ss.fff tt") %>' />
                            </ItemTemplate>
      </asp:TemplateField>
    

    CODE BEHIND

        protected void Application_RowCommand(Object sender, CommandEventArgs e)
        {
            if (e != null)
            {
                int rowIndex = Convert.ToInt32(e.CommandArgument, CultureInfo.InvariantCulture);
                string applicationID = (((System.Web.UI.WebControls.Literal)grdApplications.Rows[rowIndex].Cells[1].Controls[1]).Text).Trim();
                string lastChangeTimeString = (((System.Web.UI.WebControls.HiddenField)grdApplications.Rows[rowIndex].Cells[1].Controls[3]).Value).Trim();
    
                DateTime lastChangeTime = Convert.ToDateTime(lastChangeTimeString);
    
            }
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In my django template I have some Event items listed using a for loop.The
I have two problems with the below code that I need help fixing: 1)
Description: Based on other Similar issues listed below, it seems I would have a
I have two template files: one for the form (loginFormTemplate) and one for the
I have a template file in a folder c:\template_folder. At runtime, I will create
i have this template field inside a gridview. <asp:TemplateField ItemStyle-HorizontalAlign=Center> <ItemTemplate> <asp:ImageButton ID=ImageButton2 ImageUrl=~/images/DeleteRecord.gif
I have a template file( template.txt ): Hello, $x Hello, $y I have a
Absolute beginner question: I have a template file index.html that looks like this: ...
I have a traditional ASP.NET GridView. Inside of it I have a Template Field
I have an XML Template file. This file contains a header and some predefined

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.