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

Forums / Developing with Sitefinity / Display Times in EventView

Display Times in EventView

19 posts, 0 answered
  1. Jon Ingersoll
    Jon Ingersoll avatar
    32 posts
    Registered:
    12 May 2009
    30 Sep 2009
    Link to this post
    I'm trying to display the start and end times on the EventView control.  I've read in other posts that you need to put them in via the DateFormat property under advanced settings.

    I've set the formatting to: MMMM dd, yyyy hh:mm tt but still no dates.

    I also found this little gem:

    The EventsView control was not designed to handle date and time. So when you apply the date format it erases the time. What you could do is to add custom meta field with DateTime type and display it. 
     
    Kind regards, 
    Nikolay 
    the Telerik team  

    I find that absolutely staggering.  How does the Events module not handle times? When you create an event you give it both start and end times.  Most events don't last exactly one day, the last for a portion of that day. If outlook calendar didn't allow for times no one would use it.

    Has this issue be resolved yet? If the eventsview module still can't handle times then I feel it is a rather useless module.

    -Jon
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    30 Sep 2009
    Link to this post
    Hello Jon Ingersoll,

    The EventsView has a TextSettings control that can be used to set the Label format but not the date format. If you want to have a custom date format as this one you specified you should do the following.

    1. Map TextSettingsTemplate.ascx located under ExternalTemplates/Sitefinity/Admin/ControlTemplates/Generic_Content

    2. Modify the Panel control with ID="dateTimeFormatPanel" by adding a new Listitem to the DropDownList control. The Value of your ListItem should be the date format.

    sample:

      <asp:Panel ID="dateTimeFormatPanel" runat="server">  
                <asp:Label ID="lbl3" runat="server" Text="Date format" AssociatedControlID="dateTimeFieldFormat"></asp:Label>  
                <asp:DropDownList ID="dateTimeFieldFormat" runat="server">  
                <asp:ListItem Value="dd/MM/yyyy" Text="dd/MM/yyyy" />  
                </asp:DropDownList>  
                <class="example">Example</p>  
            </asp:Panel>  
     


    I hope this helps.

    Kind regards,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  3. Jon Ingersoll
    Jon Ingersoll avatar
    32 posts
    Registered:
    12 May 2009
    30 Sep 2009
    Link to this post
    I'm not quite sure what this code is supposed to accomplish. Is this to add a custom date format to the drop down of formats in the EventView settings?

    I'm still very confused as to why the form for creating events lets you specify times and the EventView doesn't display them without us having to jump through hoops.
  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    30 Sep 2009
    Link to this post
    Hello Jon Ingersoll,

    The declaration is supposed to add a new data format in the DropDown of EventsView. This should do the trick. We found some problems setting DateFormat  property from the advanced tab of EventsView control.

    Greetings,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  5. Jon Ingersoll
    Jon Ingersoll avatar
    32 posts
    Registered:
    12 May 2009
    30 Sep 2009
    Link to this post
    That did the trick, thanks.

    Is there a page somewhere that shows examples of valid date time formatting strings?
  6. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    30 Sep 2009
    Link to this post
    Hello Jon Ingersoll,

    You can take a look at MSDN - Date and Time Format Strings. The way that the standard date and time format strings are shown depends on the culture as well.

    Sincerely yours,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  7. Ian
    Ian avatar
    3 posts
    Registered:
    12 Aug 2008
    10 Nov 2009
    Link to this post
    Hi guys,

    Please can you tell me where to map the template with an example? I am having this exact problem but can't get it to work.

    Many thanks.
  8. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    10 Nov 2009
    Link to this post
    Hi Ian,

    1. Login to your account.
    2. Download the external templates zip archive for the version yo use.
    3. In the zip you will download - App_Data you will find a sample ControlsConfig file which has all host types you need to know when map a template.
    4. Get the template TextSettingsTemplate as described in the previous post.
    5. Create a sample ControlsConfig file under App_Data.

    <?xml version="1.0" encoding="utf-8"?>
    <controlsConfig>
      <viewMap>
     
    <viewSettings hostType="Telerik.Cms.Engine.WebControls.Design.Settings.TextSetting" layoutTemplatePath="~/Sitefinity/Admin/ControlTemplates/Generic_Content/TextSettingTemplate.ascx" />
     
    </controlsConfig>
    </viewMap>


    6. Restart the application and follow the steps from the previous post.

    Best wishes,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  9. Scott Rozman
    Scott Rozman avatar
    93 posts
    Registered:
    10 Oct 2012
    05 Feb 2010
    Link to this post
    I've just implemented this and the result on the public side was what I wanted.
    However, in my drop down list, I had
    h:mm tt ddd, MMM d, yyyy
    as my choice vs. an example of current time with that formatting applied.

    I added
    <script runat="server" language="C#">
        void Page_Load(object sender, System.EventArgs e)
        {
            liDateWithTime.Text = DateTime.Now.ToString("h:mm tt ddd, MMM d, yyyy");
        }          
    </script>
    and added an ID to my ListItem.
    <asp:ListItem ID="liDateWithTime" Value="h:mm tt ddd, MMM d, yyyy" Text="" />

    Now my drop down list shows a more friendly version.
    i.e. 4:30 PM Thu, Feb 4, 2010
  10. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    05 Feb 2010
    Link to this post
    Hello Scott Rozman,

    It is good to hear that everything works fine for you. Case closed.

    Kind regards,
    Ivan Dimitrov
    the Telerik team

    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
    Follow the status of features or bugs in PITS and vote for them to affect their priority.
  11. Laura
    Laura avatar
    311 posts
    Registered:
    25 Feb 2008
    18 Mar 2010
    Link to this post
    How do I display a date and a time with "at" such as
    March 25, 2010 at 1:00 PM
    Can I do that all in one select item?  In other words, can I insert the word "at" into the value of the ListItem like this?
    Of course this doesn't work because it is seeing the a and t as date/time formats.
    <asp:ListItem Value="MMMM d, yyyy at h:mm tt" Text="March, 18, 2010 at 2:00 p.m." />
  12. Laura
    Laura avatar
    311 posts
    Registered:
    25 Feb 2008
    18 Mar 2010
    Link to this post
    Sorry - I got it.  DUH. - use a backslash

    MMMM d, yyyy a\t h:mm tt
  13. James@Nw
    James@Nw avatar
    265 posts
    Registered:
    05 May 2009
    18 Mar 2011
    Link to this post
    Hi Guys,

    We've mapped the blog module on our home page so that we can skin it the way we like as follows:

    ~/Sitefinity/MappedTemplates/Blogs/ContentViewItemList.ascx

    What we need now is to change the date format from this

    28 February 2011.

    to this:

    28 Feb '11

    In the mapped control, I can see where the date is pulling in:

    <p class="sf_postDate">
                    <telerik:DateTimeLiteral ID="Publication_Date" runat="server" DateFormatString="dd MMM yyyy" /></telerik:DateTimeLiteral>
                </p>

    What's happening in SF is that the blog post has been published as 14 February 2011 and yet in my mapped control the order is incorrect. What I have had to do is to turn it around so that it reads yy MMM dd for it show correctly.

    Although this is not a train smash, we still need the apostrophe so that it reads as 28 Feb '11

    Thanks


  14. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    18 Mar 2011
    Link to this post
    Hello James@Nw,

    You can get the data item from the repater control that is inside the template and set get the metadata for the Publication_Date. Then you can use String.Format to show the desired date format.

    Regards,
    Ivan Dimitrov
    the Telerik team
  15. James@Nw
    James@Nw avatar
    265 posts
    Registered:
    05 May 2009
    22 Mar 2011
    Link to this post
    Hi Ivan,

    Can you please elaborate a bit more?

    Where do I get the data item from the repeater control and how do I set the metadata for the Publication_Date?

    Can you give me an example of this please?

    Thanks


  16. James@Nw
    James@Nw avatar
    265 posts
    Registered:
    05 May 2009
    22 Mar 2011
    Link to this post
    Hi Ivan

    I am trying to follow your instructions.

    Do you mean that I should change this?

    <telerik:DateTimeLiteral ID="Publication_Date" runat="server" DateFormatString="yy MMM dd"  /></telerik:DateTimeLiteral>

    And what do I change this too? How do I add the String.Format?

    Thanks
  17. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    22 Mar 2011
    Link to this post
    Hello James@Nw,

    The repeater is bound the IContent objects. You can access them from the repeater and use GetMetaData("Publication_Date"). In the template you can add a new label and set its Text using the String.Format

    Kind regards,
    Ivan Dimitrov
    the Telerik team
  18. James@Nw
    James@Nw avatar
    265 posts
    Registered:
    05 May 2009
    22 Mar 2011
    Link to this post
    Hi Ivan,

    This still doesn't make sense to me as my .Net skills do not extend to what you are suggesting but I am willing to learn from what you're saying.

    I am adding my file for you here if you could please add the changes you have suggested so that I know what you are referring to.

    http://www.zendump.com/download.php?file=4b246e0aa3320b18a7b4f27c7f7b646e


    Thanks
  19. James@Nw
    James@Nw avatar
    265 posts
    Registered:
    05 May 2009
    23 Mar 2011
    Link to this post
    Hi Ivan,

    It seems there is some confusion here. I am trying to implement this date change in two different ways.

    1. According the instructions I am seeing in this post.
    2. According to instruction coming from this post http://www.sitefinity.com/devnet/forums/sitefinity-4-x/bugs-issues/problems-changing-the-date-and-time-for-blog-entries.aspx

    The latter, allows me to create a drop down option for a date format but even if I implement this, it does not work.

    I'd appreciate a definitive answer on what the better method is to change the date format so that we can get this resolved please.

    Many thanks,
    James
Register for webinar
19 posts, 0 answered