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

Forums / Developing with Sitefinity / Events Module - Event formatting changes if I edit the control

Events Module - Event formatting changes if I edit the control

3 posts, 0 answered
  1. Justin
    Justin avatar
    16 posts
    Registered:
    21 Oct 2007
    31 Jul 2008
    Link to this post
    I am having trouble with the formatting of the EventsView control.  I place an EventsView control on a page and a get a default layout for the list which I happen to like.  It shows only the following

    Mens Breakfast

    Thursday, July 31, 2008 (this is the date it was added and not the date of the event, which seems odd)

    Description of the event...

    But if I edit the page and do something really simple like uncheck Past Events on step #1 on the Basic tab and then click I'm done, it changes the layout of the EventsView to something pretty ugly and displays all of the following:

    Men's Breakfast - in a large font
    8/2//2008 7:30:00 AM
    8/2//2008 9:00:00 AM
    Description of the event...
    Street:
    City:
    Country:
    State:

    I haven't learned yet how to implement my own view of the event to show just what I want to show in this list but why is the initial format one way and then changes when I make a simple config change for the EventsControl?


    Thanks,
    Justin
  2. Justin
    Justin avatar
    16 posts
    Registered:
    21 Oct 2007
    31 Jul 2008
    Link to this post
    One more question in addition to those above.  When I view the EventsView control configuration online with the TUI demo, I see there are more configurable options for EventsView than what I am seeing on my latest install of 3.2 build 1616.  Specifically, on the TIU demo site online there is a 3rd config option on the Basic tab but on my version I only have options 1 and 2.

    Any insight would be appreciated!
    Justin
  3. Ivan
    Ivan avatar
    478 posts
    Registered:
    16 Jun 2015
    11 Aug 2008
    Link to this post
    Hi Justin,

    Regarding your first question:
    The reason this is happening lays in the fact that EventsView control existed before we've implemented and we needed to provide some kind of backward compatibility. Namely, before the new ContentView designers we had only one mode for each control and the template names were usually: ContentViewItemList.ascx and ContentViewSingleItem.ascx. With the new ContentView designers we have introduced modes and the templates are now in the Modes folder (e.g. ~/Sitefinity/ControlTemplates/Events). So when we introduced the new ContentViewDesigner we didn't want to break all the existing controls, therefore before you open the EventsView control for the first time it is using the old templates. If you wish the initial template to be used instead of the one that appears after you make a change to settings, please do following:

    1. Open this file:
      ~/Sitefinity/Admin/ControlTemplates/Events/Design/EventsViewControlDesigner.ascx
    2. Modify the listPageMode PresentationMode in following manner:

    These two lines:

    MasterTemplatePath="~/Sitefinity/ControlTemplates/Events/Modes/ListPageMaster.ascx"   
    DetailTemplatePath="~/Sitefinity/ControlTemplates/Events/Modes/ListPageDetail.ascx" 

    change into these two lines:

    MasterTemplatePath="~/Sitefinity/ControlTemplates/Events/ContentViewItemList.ascx"   
    DetailTemplatePath="~/Sitefinity/ControlTemplates/Events/ContentViewSingleItem.ascx" 

    By doing so, you will effectively change the master/detail templates that this particular PresentationMode uses.

    To your second question:

    The new ContentView designers are extensible and configurable without doing any coding. The reason you are seeing more configurable options on the demo TUI site is because the UX team that works on the demo site decided to add more options. This is very simple to do and I will briefly explain how can you do that in your project as well.

    Open this file:
    ~/Sitefinity/Admin/ControlTemplates/Events/Design/EventsViewControlDesigner.ascx.

    This is a file that controls the designer of the EventsView control. You have already opened it earlier to change the templates a presentation mode uses. Now, this time we will add one more setting for the master mode.

    Please find the following tag on the page:

    <sfDesign:PresentationModeSettings ID="ModesSettings1" runat="server"

    and then locate the collection of MasterSettings controls. You will see there are several settings there, some of them are called TextSettings some ContentSettings. Those are the two built in settings in Sitefinity. You can add new settings to this collection, by simply following the pattern. Let's assume you have a RegistrationPrice meta field and you want to add the setting in the designer for this meta field. Here is what you would add to the MasterSettings collection:

    <sfDesignSettings:TextSetting ID="TextSettingRegPrice" 
                                                  TargetID="RegistrationPrice"   
                                                  SettingTitle="Registration Prive"   
                                                  AllowLabelSetting="True"   
                                                  AllowVisibilitySetting="True" 
                                                  TargetVisibleByDefault="True">  
                                                  </sfDesignSettings:TextSetting> 

    I'll walk you briefly through the settings we have set:

    • ID - id of the setting. It is not important to what you set it as long as it is unique
    • TargetID - id of the control in the MasterTemplate that this setting is controlling
    • SettingTitle - title of the setting that users will see in the ContentViewDesigner
    • AllowLabelSetting - will users be able to set the label for this RegistrationPrice control (e.g "Price")
    • AllowVisibilitySetting - will users be able to hide and show RegistrationPrice control
    • TargetVisibleByDefault - will RegistrationPrice control be visible by default or not

    I hope you will find this information helpful. Let us know if there is anything else we can do for you.

    Greetings,
    Ivan
    the Telerik team


    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Register for webinar
3 posts, 0 answered