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

Forums / Developing with Sitefinity / Adding Provinces to the Event Module

Adding Provinces to the Event Module

5 posts, 0 answered
  1. KMac
    KMac avatar
    133 posts
    Registered:
    15 Dec 2008
    23 Jul 2010
    Link to this post
    Hello,

    I'm just trying to edit the EventItemNew and EventItemEdit templates so that people can choose provinces (since I'm from Canada). But even though I add them to the State dropdownlist, the moment I choose Canada from the Country list the whole State dropdown disappears. Some consipiracy theorists would definitely have something to say about that. Me, I would just like to know how to stop it from happening.

    Thanks,

    Kalvin
  2. KMac
    KMac avatar
    133 posts
    Registered:
    15 Dec 2008
    23 Jul 2010
    Link to this post
    Sorry, one other question:

    I want to hide the Event End Date if people do not fill it in (i.e. for one day events). Normally, and this is probably the lazy way, but I'd just add something like this:

    <

     

     

    asp:Literal ID="Event_End" runat="server" Visible='<%# (Eval("Event_End") != null) ? true : false %>' />

     


    But I don't know what I need to do in order to access Event_End or any metafield for that matter. Everything I try seems not to fire. So, how can I?

    Thanks again,

    Kalvin
  3. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    25 Jul 2010
    Link to this post
    Hi KMac,

      and Events start always have a value even if someone has not selected anything. You need to access the control from the ContentMetaFields controls collection (MetaFields.Controls[0].FindControl("someId")) and add some attribute on SelectedDateChanged. Then you need to check whether this attribute exists or not. If there is no attribute the date has not been changed.

    Regards,
    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
  4. KMac
    KMac avatar
    133 posts
    Registered:
    15 Dec 2008
    27 Jul 2010
    Link to this post
    Hi Ivan,

    Thanks for this. I'm having trouble understanding though since there doesn't seem to be an object named MetaFields. I'm currently just working with the ContentViewItemView.ascx and really just want to hide the Event_End item if someone selects say the max value. I tried accessing the controls in the repeaters ItemDatabound event but no luck. What am I missing? Also have you had a chance to think about my first question here. Somehow not hiding the State dropdown when the Country is changed to Canada (or anything other than the US).

    Thanks,

    Kalvin
  5. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    27 Jul 2010
    Link to this post
    Hi KMac,

    For the public control - EventsView, you have to create a custom class that inherits from EventsView. Then, override SetItemMetadata method from where you can have access to each content item and all metakeys. If you want to check the metakey for details mode you have to override SetSingleItemContent method.

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using Telerik.Events.WebControls;
    using Telerik.Cms.Engine.ContentViewFiltering;
    using Telerik.Cms.Engine;
    using System.Web.UI;
    using System.Web.UI.WebControls;
     
    /// <summary>
    /// Summary description for EventsViewCustomControl
    /// </summary>
    public class EventsViewCustomControl : EventsView
    {
        public EventsViewCustomControl()
        {
        }
     
        public override string ItemListTemplatePath
        {
            get
            {
                return "~/Sitefinity/Admin/ControlTemplates/Events/Modes/ListPageMaster.ascx";
            }
     
        }
     
        public override string SingleItemTemplatePath
        {
            get
            {
                return "~/Sitefinity/Admin/ControlTemplates/Events/Modes/ListPageDetail.ascx";
            }
     
        }
        protected override void SetItemMetadata(Control itemContainer, IContent contentItem)
        {
            base.SetItemMetadata(itemContainer, contentItem);
     
            DateTime pd = (DateTime)contentItem.GetMetaData("Event_Start");
           

            DateTime ed = (DateTime)contentItem.GetMetaData("Event_End");
        

     
        }
     
         
        protected override void SetSingleItemContent(IContent item)
        {
            base.SetSingleItemContent(item);
        }
     
    }


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