More in this section

Forums / Developing with Sitefinity / Using Event Schedule View to show Category

Using Event Schedule View to show Category

8 posts, 0 answered
  1. WebGeek
    WebGeek avatar
    186 posts
    Registered:
    20 Dec 2006
    11 Sep 2009
    Link to this post
    I would like to just show a certain category of events on a certain pages.  For example - page1.aspx show category1, page2.aspx show category 2.  How can I select the category using the Event Schedule View control? 
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    11 Sep 2009
    Link to this post
    Hi medicalwebgeek,

    EventsScheduleView does not support FilterExpression so you cannot show items filtered by any category.
    You could override the control and under InitializeControls to get a list of event items and filter them.
    Also when you click on an item you are redirected to a single content where you do not have a list of categorized items.

    All the best,
    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. WebGeek
    WebGeek avatar
    186 posts
    Registered:
    20 Dec 2006
    11 Sep 2009
    Link to this post
    I have 300 events and I need them set to categories.  This was possible with previous versions - even though I had to find out what the GUID was for the category.  What is QueryString Keys for?  EventCatID??
  4. Radoslav Georgiev
    Radoslav Georgiev avatar
    3370 posts
    Registered:
    01 Feb 2016
    11 Sep 2009
    Link to this post
    Hello medicalwebgeek,

    Here is a quick sample of how to make the EventsScheduleView to filter events by category. To do so I will place an Events Schedule View and Category List control on my page that will display events. Then I will configure the CategoryKeyType property of the Category List control to be Name (see attached image). Now all I have to do is to modify the AppointmentDataBound event of the RadScheduler inside the Events Schedule View control to filter events by category name. Add the following script to the ~/Sitefinity/ControlTemplates/Events/EventsScheduleView.ascx:
    protected void Page_Load(object sender, EventArgs e) 
        { 
            eventsSchedule.AppointmentDataBound+=new AppointmentDataBoundEventHandler(eventsSchedule_AppointmentDataBound); 
        } 
    void  eventsSchedule_AppointmentDataBound(object sender, SchedulerEventArgs e) 
        { 
            string EventCatName = ""
            if (Request.QueryString.Get("EventCatID") != null
            { 
                EventCatName = Request.QueryString.Get("EventCatID"as string
                var eventtofilter = (Telerik.Events.Data.CntEvent)e.Appointment.DataItem; 
                string eventCat = eventtofilter.ContentItem.GetMetaData("Category"as string
                if (eventCat != EventCatName) 
                eventsSchedule.DeleteAppointment(e.Appointment, false); 
                } 
        } 

    Since the category list control sends the selected category name by the query string, the scheduler takes the category name and deletes all appointments that do not mach the category.

    I hope that this will help you. If you have more questions, please feel free to contact us.

    Regards,
    Radoslav Georgiev
    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. WebGeek
    WebGeek avatar
    186 posts
    Registered:
    20 Dec 2006
    11 Sep 2009
    Link to this post
    Thank you for your help so far.  I have done as you suggested by mapping the external template for Event Schedule View. 

    Where do I set the Category name at?  Can I use the Guid since some of my category names are the same because they are members of parent categories.

    For Example:
    Parent Category 1
    Child Name Bob
    Child Name Mary

    Parent Category 2
    Child Name Bob
    Child Name Mary

    It would be nice to be able to select the category from the tree or something of that nature.
  6. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    13 Sep 2009
    Link to this post
    Hi medicalwebgeek,

    In CategoriesTree control you can set CategoryKeyType as ID and CategoryKey as EventCatID.

    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.
  7. Laura
    Laura avatar
    311 posts
    Registered:
    25 Feb 2008
    18 Mar 2010
    Link to this post
    Not sure if this is the right thread but I am trying to show a list of events for a certain category. Now I am using 3.6 SP2 and for the Events View control I am pointing to my custom control - ListPageMaster in the Events folder. 

    In reading through various posts, I went in to the Advanced tab and found 'SelectedCategories' under Obsolete members, and was able to select the category i needed.  This method actaully does seem to work ... so do I need any additional programming?

    I only question this because of 1)the posts and other solutions I have read, 2) it is under 'Obsolete members' .

    Thanks as always in advance.
  8. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    19 Mar 2010
    Link to this post
    Hi Laura,

    The obsolete members are left for backward compatibility. We have not exclude the from the code, and probably we will keep them in the control designer. Anyhow, you can use FilterExtession property of the control to filter the list of Events.

    Category = "MyCategory"

    I hope that this helps.

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