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

Forums / Developing with Sitefinity / events - can events details have different themes?

events - can events details have different themes?

4 posts, 0 answered
  1. Meister
    Meister avatar
    262 posts
    Registered:
    09 Nov 2007
    23 Sep 2009
    Link to this post
    Hi

    I have a bunch of events, however, i need to have different themes for each one

    e.g. if there is a christmas event, i would like to be able to select this, and load in the christmas theme
    same for halloween etc

    i'd need to control this on the event level.
    is this possible?

    also, is it possible to add another column to the event view list in the backend? i have some events with the same name and i'd like to show the start date so i can distingiush between them

    thanks
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    24 Sep 2009
    Link to this post
    Hello Quade,

    You  can create a custom class that derives from EventsView control that override SetSingleItemContent or SetItemMetaData method. Then you have access to the content item. You should create some identifier that will be used for differ the items.

    Below is a sample code:

     //override SetItemMetadata method.  
        protected override void SetItemMetadata(System.Web.UI.Control itemContainer, IContent contentItem) 
        { 
            base.SetItemMetadata(itemContainer, contentItem); 
     
            if (ChangeTextProperty.Text !=null && ChangeTextProperty.Text == "NewYear"
            { 
                // style all events 
            } 
            if (ContentItemTextProperty.Text == contentItem.GetMetaData("Title")) 
            { 
                // style single event 
            } 
        } 


    also, is it possible to add another column to the event view list in the backend? i have some events with the same name and i'd like to show the start date so i can distingiush between them

    Yes, you can do this. You should map EventsItemsList.ascx external template.  Add new ClientTemplate control inside ClientTemplateHolder as shown below:

    <telerik:ClientTemplate Name="Status" runat="server">{#PublicationDate#}</telerik:ClientTemplate> 

    Then add new GridTemplateColumn

    <telerik:GridTemplateColumn UniqueName="PublicationDate" HeaderText="<%$ Resources:PublicationDate %>"
    </telerik:GridTemplateColumn> 

    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. Meister
    Meister avatar
    262 posts
    Registered:
    09 Nov 2007
    06 Oct 2009
    Link to this post
    thanks Ivan thats great

    regarding the first example, would this just look at the event title, and pull in a theme based on this?

    If i wanted to add a drop down on the event itself that pulls through all available themes, and allows you to select a theme this way, would that be a lot more involved?

    thanks
  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    06 Oct 2009
    Link to this post
    Hi Quade,

    Create an enum as a property and populate it with all themes. Sample:

        public enum Themes 
        { 
            ThemeA, 
            ThemeB, 
            ThemeC 
        } 
     
     
        public Themes MyThemes 
        { 
            get { return _load; } 
            set { this._load = value; } 
        } 
        private Themes _load; 


    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.
Register for webinar
4 posts, 0 answered