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

Forums / Developing with Sitefinity / Event Categories...

Event Categories...

6 posts, 0 answered
  1. Todd
    Todd avatar
    3 posts
    Registered:
    09 Apr 2008
    25 Mar 2009
    Link to this post
    Hello,

    I am currently using version 3.2 and am trying to assign a category to a specific page.

    What I am trying to do is set up events for 3 different categories on 3 different pages which I have created in the modules, the catergories are:

    Cananda
    U.S
    Int

    Can someone please HELP me with the the steps to set an event for an individual category.
     
    Thanks,

    Todd
  2. Stoyanka Assenova
    Stoyanka Assenova avatar
    113 posts
    Registered:
    01 Dec 2016
    26 Mar 2009
    Link to this post
    Hi Todd,

    This is still not implemented in Sitefinity version 3.2.
    This functionality has been introduced in the service pack - 3.2 SP1. However, there were some known issues so our recommendation is to upgrade to version 3.5.

    If you have any problems, don't hesitate to contact us.

    Regards,
    Stoyanka Assenova
    the Telerik team

    Check out Telerik Trainer , the state of the art learning tool for Telerik products.
  3. Garry Clark
    Garry Clark avatar
    26 posts
    Registered:
    27 Jan 2005
    06 May 2009
    Link to this post
    Stoyanka,
    Can you still provide the method to do this for 3.6 SP? I have looked in the manual and can not see hwo to defien what event category gets displayed ona  certain page. There also seems to be nothing in the module settings to allow selection of the category.

    Any help would greatly be appareciated as we will have numerous event categories.

    Thanks!
  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    06 May 2009
    Link to this post
    Hello Garry Clark,

    From version 3.2 SP1 you can set filter expression to the content items you want to be listed.You need to open the control in edit mode, go to advanced tab, expand Filters category and there you will find filterExpression property . You can set the following condition in the textbox: Category = "MyCategoryName". Thus the control will list all items that have been categorized with MyCategoryName.

    Here are how you can get this working programmatically. - two approaches.

    1. Using IMetaSearchInfo filter
       ContentManager eventsManager = new ContentManager("Events"); 
            string CategoryName = "FirstCategory"
            List<IMetaSearchInfo> filter = new List<IMetaSearchInfo>(); 
            filter.Add(new MetaSearchInfo(MetaValueTypes.ShortText, "Category", CategoryName, SearchCondition.Equal, JoinType.And)); 
            IList listofAllItems = eventsManager.GetContent(0, 0, filter.ToArray()); 
            foreach (IContent contentItem in listofAllItems) 
            { 
                Response.Write(contentItem.GetMetaData("Title")); 
            } 

    2. Using ContentFilterbuilder - the better solution.

    ContentManager eventsManager = new ContentManager("Events"); 
    string CategoryName = "FirstCategory"
    IList listofAllEvents = eventsManager.GetContent(); 
    EventsView eventsViewControl = new EventsView(); 
    ContentFilterBuilder filterBuilder = new ContentFilterBuilder(eventsViewControl); 
    filterBuilder.AddFilter(new ContentFilterStatement("Category", CategoryName, ContentFilter.Condition.Equal, ContentFilter.JoinType.And)); 
    Controls.Add(eventsViewControl); 
           

    I hope this helps.

    Greetings,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  5. Garry Clark
    Garry Clark avatar
    26 posts
    Registered:
    27 Jan 2005
    06 May 2009
    Link to this post
    Ivan,
    I see how I can do this from the Events View, thank you, but how can I do the samething in the Event Schedule view?
  6. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    07 May 2009
    Link to this post
    Hello Garry Clark,

    You need to create custom control that  inherits EventsScheduleView, override layout template path( if you want to use custom appearance of the control). then override InitializeControls and create AppointmentCreated handler where you can filer the items.

    Sample code:

    using System; 
    using System.Web.UI.WebControls; 
    using Telerik.Events; 
    using Telerik.Events.WebControls; 
     
    /// <summary> 
    /// Summary description for MyEventsScheduleView 
    /// </summary> 
    public class MyEventsScheduleView : EventsScheduleView 
        public MyEventsScheduleView() 
        { 
        } 
     
        // override template path. 
        public override string LayoutTemplatePath 
        { 
            get 
            { 
                if (string.IsNullOrEmpty(this.layoutTemplatePath)) 
                    this.layoutTemplatePath = "~/Sitefinity_3_6_1870_standard_ExternalTemplates/Sitefinity/ControlTemplates/Events/EventsScheduleView.ascx"
                return this.layoutTemplatePath; 
            } 
            set 
            { 
                this.layoutTemplatePath = value; 
            } 
        } 
         
        // override InitializeControls 
        protected override void InitializeControls(System.Web.UI.Control controlContainer) 
        { 
            //call base class 
            base.InitializeControls(controlContainer); 
            // create our own hanlder where we will add our implementation 
            this.EventsSchedule.AppointmentCreated += new Telerik.Web.UI.AppointmentCreatedEventHandler(MyEventsSchedule_AppointmentCreated); 
     
        } 
     
        void MyEventsSchedule_AppointmentCreated(object sender, Telerik.Web.UI.AppointmentCreatedEventArgs e) 
        { 
            // clear whatever the base handler may have done 
            e.Container.Controls.Clear(); 
     
            // create a new instance of EventsManager 
            // if there is an event created we customize it. 
            EventsManager eventsManager = new EventsManager("Events"); 
             
           // ADD YOUR LOGIC HERE 
        } 
     
        private string layoutTemplatePath; 
     


    Regards,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
Register for webinar
6 posts, 0 answered