+1-888-365-2779
Try Now
More in this section

NewsView Date

5 posts, 1 answered
  1. Bruno Michels
    Bruno Michels avatar
    125 posts
    Registered:
    16 Apr 2010
    11 May 2010
    Link to this post
    I want to display the date in the following format:
    dddd, d \d\e MMMM \d\e yyyy HH:mm

    But the Hour and Minute comes as 00.

    How can I get the correct value?
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    11 May 2010
    Link to this post
    Hi Bruno Michels,

    Please take a look at the suggestion provided in this post. You could add your custom format to TextSettingTemplate. Another option is overriding SetItemMetaData of NewsView control and setting the desired format to a Label or other control you would like to use in your template.

    Best wishes,
    Ivan Dimitrov
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
    Answered
  3. Bruno Michels
    Bruno Michels avatar
    125 posts
    Registered:
    16 Apr 2010
    11 May 2010
    Link to this post
    That solved my problem.

    But why a Telerik.Cms.Web.UI.DateTimeLiteral only works for Dates? Shouldn't it be DateLiteral instead?
  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    11 May 2010
    Link to this post
    Hi Bruno Michels,

    The control renders DateTime.Parse(value);

    Sincerely yours,
    Ivan Dimitrov
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  5. Bruno Michels
    Bruno Michels avatar
    125 posts
    Registered:
    16 Apr 2010
    11 May 2010
    Link to this post
    Then why it converts the time 05:38 to 00:00?

    I changed the property of NewsView control (DatesFormat: Gets or sets date and time format string. Date and time format strings control formatting operations in which a date and/or time is represented as a string.) to dddd, d \d\e MMMM \d\e yyyy HH:mm

    In the external template I added a sf:DateTimeLiteral, the value came to the control, but only the date was correct, the time was 00.


    I solved this issue with a workaround, I mapped the external template TextSettingTemplate.ascx and added to the list the format I wanted and I've set a literal field on the NewsView template, that solved the problem.
Register for webinar
5 posts, 1 answered