More in this section
Blogs RSS feed

Group appointments by event categories in a custom Events Schedule View

by User Not Found
This week's Tip of the Week post samples a custom Events Schedule View that allows us to group event items in the RadScheduler by the categories events belong to. For the purposes of this we will need to create a custom control that inherits from the built in Events Schedule View control and override some of its methods.


By default the RadScheduler control in the Events Schedule View is bound to an object data source. This object data source takes relevant event items from the Events Module and then feeds them to the Scheduler. However by design this does not allow us to group appointments in the scheduler by categories for example. So first thing that we have to do is to bind the RadScheduler to our custom data source object that will allow is to perform the desired. We have to start by creating the container that will hold the necessary information for the RadScheduler's appointments. Bellow is a sample class that does the required:

using System; 
using Telerik.Cms.Engine; 
using Telerik.Events; 
namespace Telerik.Samples.Events.DataSources 
    /// <summary> 
    /// This class is a container that will hold all necessary information  
    /// for appointment items - the event item from Events Module and its category ID 
    /// to allow grouping by categories 
    /// </summary> 
    public class AppointmentInfo 
        private string id; 
        private string subject; 
        private DateTime start; 
        private DateTime end; 
        private Guid categoryID; 
        private IEvent eventItem; 
        public string ID 
            get { return id; } 
            set { id = value; } 
        public string Subject 
            get { return subject; } 
            set { subject = value; } 
        public DateTime Start 
            get { return start; } 
            set { start = value; } 
        public DateTime End 
            get { return end; } 
            set { end = value; } 
        public Guid CategoryID 
            get { return categoryID; } 
            set { categoryID = value; } 
        public AppointmentInfo(IEvent eventItem) 
            this.eventItem = eventItem; 
   = eventItem.ID.ToString(); 
            this.subject = eventItem.EventTitle; 
            this.start = eventItem.Start; 
            this.end = eventItem.End; 
            string categoryName = eventItem.ContentItem.GetMetaData("Category").ToString(); 
            if (categoryName != null
                Telerik.Cms.Engine.ContentManager manager = new ContentManager("Events"); 
                ICategory category = manager.GetCategory(categoryName); 
                    this.categoryID = category.ID; 

Once we are done with the container class it is time to start our custom control. As mentioned above the control will be derived from the built in Events Schedule View. We will have to override the InitializeControls method and point the Scheduler to our custom data source. In this same method we have to also create an object data source for our the categories form Events module. We can also make the Scheduler paint each appointment based on the category it belongs to. Sample code bellow:

using System; 
using System.Collections.Generic; 
using System.ComponentModel; 
using System.Web.UI; 
using System.Web.UI.WebControls; 
using Telerik.Cms.Engine; 
using Telerik.Events; 
using Telerik.Events.WebControls; 
using Telerik.Samples.Events.DataSources; 
using Telerik.Web.UI; 
namespace Telerik.Samples.Events.WebControls 
    /// <summary> 
    /// Summary description for CustomScheduleView 
    /// </summary> 
    public class CustomScheduleView : EventsScheduleView 
        //our custom datasource for event items 
        private System.Collections.Generic.List<AppointmentInfo> appointments; 
        private EventsManager eventsManager; 
        [Description("Gets or sets the path to a custom layout template for the control.")] 
        public override string  LayoutTemplatePath 
                 return "~/Sitefinity/ControlTemplates/Events/EventsScheduleView.ascx"
                base.LayoutTemplatePath = value; 
        protected override void InitializeControls(Control controlContainer) 
            if (Page == null || DesignMode) 
                Label noDesignModeLabel = new Label(); 
                noDesignModeLabel.Text = "The Events Schedule View control cannot be rendered in Design Mode"
                this.EventsSchedule.Visible = false
                if (base.CssFileLink1 != null
                    base.CssFileLink1.AssemblyInfo = base.AssemblyInfo; 
                //we have to bind the RadScheduler control to a custom data source that holds all necessary information 
                appointments = new List<AppointmentInfo>(); 
                this.eventsManager = new EventsManager("Events"); 
                foreach (IEvent _event in eventsManager.GetEvents()) 
                    if (_event.ContentItem.Status == Telerik.Cms.Engine.ContentStatus.Published) 
                        appointments.Add(new AppointmentInfo(_event)); 
                this.EventsSchedule.DataSource = appointments; 
                this.EventsSchedule.DataKeyField = "ID"
                this.EventsSchedule.DataSubjectField = "Subject"
                this.EventsSchedule.DataStartField = "Start"
                this.EventsSchedule.DataEndField = "End"
                this.EventsSchedule.AllowDelete = false
                this.EventsSchedule.AllowInsert = false
                this.EventsSchedule.AllowEdit = false
                this.EventsSchedule.AppointmentCreated += new Telerik.Web.UI.AppointmentCreatedEventHandler(EventsSchedule_AppointmentCreated); 
                //create an object data source that will extract categories from the Events module 
                ObjectDataSource categoriesDataSource = new ObjectDataSource(); 
                categoriesDataSource.ID = "categoriesDataSource"
                categoriesDataSource.TypeName = "Telerik.Cms.Engine.ContentManager"
                categoriesDataSource.SelectMethod = "GetCategories"
                categoriesDataSource.ObjectCreating += new ObjectDataSourceObjectEventHandler(categoriesDataSource_ObjectCreating); 
                ResourceType rt = new ResourceType("Category"); 
                rt.DataSource = categoriesDataSource; 
                rt.KeyField = "ID"
                rt.TextField = "CategoryName"
                rt.ForeignKeyField = "CategoryID"
        void categoriesDataSource_ObjectCreating(object sender, ObjectDataSourceEventArgs e) 
            e.ObjectInstance = new ContentManager("Events"); 
        void EventsSchedule_AppointmentCreated(object sender, Telerik.Web.UI.AppointmentCreatedEventArgs e) 
            IEvent event2 = this.eventsManager.GetEvent(new Guid(e.Appointment.ID.ToString())); 
            HyperLink link = (HyperLink)e.Container.FindControl("eventDetailsLink"); 
            if (link != null
                link.Text = e.Appointment.Subject; 
                link.NavigateUrl = this.GetItemUrl(event2.ContentItem, this.SingleEventUrl); 
            string category = event2.ContentItem.GetMetaData("Category").ToString(); 
            //here you can style the appearance of each appointment 
            //for simplicity we use built-in RadScheduler CSS classes 
                e.Appointment.CssClass= "rsCategory"+category; 

Now all we have to do is to modify the markup of the RadScheduler to set it to group appointments by category. For this we have to change the control template of our custom control. Above you can see that we are using this file - ~/Sitefinity/ControlTemplates/Events/EventsScheduleView.ascx for control template. Add the highlighted to the Scheduler markup:

<telerik:RadScheduler ID="eventsSchedule" runat="server" 
 SelectedView="TimelineView" GroupingDirection="Vertical" GroupBy="Category"
        <asp:HyperLink id="eventDetailsLink" runat="server" />  

Finally add the control to our Sitefinity toolbox. Add the bellow markup to the web.config:

  <add name="Custom Schedule View" section="Custom Controls" type="Telerik.Samples.Events.WebControls.CustomScheduleView, App_Code"/> 


The above modifications will make the scheduler group events as in this image:

Custom Events Schedule View

You can take a look at the following articles in order to gain a better idea on how to style the Scheduler to make it look the way you want.

RadScheduler - Controlling Appearance

RadScheduler - Setting styles for appointments

You can download all the code that was sampled in this post from here:   Custom Schedule View


Leave a comment
  1. james Mar 29, 2018

    This was really what I was searching for, and I am happy to came here ! A debt of gratitude is in order for offering the such data to us. 


    human hair extensions

  2. james Mar 31, 2018
    Got my pvt ltd company at Rs.13999 from easy, fast, reliable, secure, completely hassle free online company registration. pvt ltd company
  3. Warmtepomp Apr 09, 2018
    Your house is valueble for me. Thanks!? This web page can be a walk-via for the entire information you needed about this and didn know who to ask. Glimpse here, and also you l definitely discover it. Warmtepomp
  4. mehr followers Apr 10, 2018
    Man that was very entertaining and at the same time informative..,*,` mehr followers
  5. Apr 10, 2018
    There are actually a lot of details like that to take into consideration. That could be a nice point to carry up. I offer the ideas above as general inspiration however clearly there are questions just like the one you carry up the place a very powerful thing will probably be working in honest good faith. I don?t know if best practices have emerged round issues like that, however I am sure that your job is clearly identified as a good game. Each girls and boys feel the impression of only a moment’s pleasure, for the rest of their lives.
  6. بهترین وکیل ملکی Apr 11, 2018
    You made some decent points there. I looked on the web for the problem and discovered most people may go together with with the web site. بهترین وکیل ملکی
  7. formula como funciona Apr 11, 2018
    An fascinating discussion may be worth comment. There’s no doubt that that you simply write read more about this topic, it will not be described as a taboo subject but normally people are insufficient to chat on such topics. An additional. Cheers formula como funciona
  8. Lucht/lucht warmtepomp Apr 11, 2018
    Thanks for the great post against your blog, it genuinely provides me with a look about this topic.??;~.?? Lucht/lucht warmtepomp
  9. Zwembad monoblok Apr 15, 2018
    Good day. your writing style is great and i love it.  Zwembad monoblok
  10. Lucht-water warmtepompen Apr 16, 2018
    Very interesting points  you have  observed ,  thankyou  for  putting up. Lucht-water warmtepompen
  11. mamae sarada funciona Apr 16, 2018
    Excellent read, I just passed this onto a colleague who was doing a little study on that. And he actually bought me lunch because I found it for him smile So let me rephrase that: Thanks for lunch! mamae sarada funciona
  12. RVSM air data test set Apr 17, 2018
    Thanks for all of your work on this blog. My mother really loves managing investigations and it’s really obvious why. A lot of people know all of the compelling method you create very important strategies on this web blog and as well recommend response from visitors on the matter so my daughter is now studying so much. Take pleasure in the rest of the new year. Your carrying out a fantastic job. RVSM air data test set
  13. this website Apr 17, 2018
    It’s arduous to search out educated people on this subject, but you sound like you already know what you’re talking about! Thanks this website
  14. what does rent to own mean Apr 17, 2018
    Very interesting points  you have  observed ,  thankyou  for posting . what does rent to own mean
  15. nsf clothing Apr 24, 2018
    The the next time I read a blog, I’m hoping who’s doesnt disappoint me about that one. I mean, I know it was my replacement for read, but I really thought youd have some thing fascinating to talk about. All I hear is really a number of whining about something you could fix when you werent too busy searching for attention. nsf clothing
  16. ytmp3 Apr 27, 2018
    Speed adult dating provides you with a level smaller time that will get that promotion. As an alternative internet dating strategy, it may be a lot of fun. A person sit reverse of somebody in addition to each of you own a few momemts to tell the other regarding oneself. When the bell much more everyone switch about the next kitchen table, start out during sq . one and also duplicate. ytmp3
  17. 2nd puc karnataka results Apr 28, 2018
  18. Lucky Patcher Apr 29, 2018
    Excellent publish from specialist also it will probably be a fantastic know how to me and thanks very much for posting this useful data with us all. Lucky Patcher
  19. cheap tour package indonesia Apr 29, 2018
    I think more writers should take care to write with passion like you.  Even informational articles like this can have personality.  That’s what you have interjected in this informative article.  Your views are very unique. cheap tour package indonesia
  20. Alexander Mirza Apr 30, 2018
    Thank you for another informative website. The place else may I get that type of info written in such an ideal manner? I have a mission that I am simply now working on, and I have been on the look out for such information. Alexander Mirza
  21. May 01, 2018
    Outstanding post, I think   blog owners  should  larn  a lot from this blog  its  really  user  genial .
  22. twitter May 01, 2018
    Thank you for your site post. Jones and I are actually saving to get a new publication on this issue and your post has made all of us to save our own money. Your notions really clarified all our questions. In fact, more than what we had thought of prior to when we stumbled on your wonderful blog. We no longer nurture doubts as well as a troubled mind because you have actually attended to our own needs in this post. Thanks twitter
  23. rajasthan board 12th result 2018 May 04, 2018
    It really is perfect time to make several plans for the future and it is time to be happy. I’ve read this post and if I could I desire to recommend you few useful points or advice. Maybe you can publish next articles referring to this post. I want to read more things about it! rajasthan board 12th result 2018
  24. Youtube MP3 Converter May 04, 2018
    I just added this site to my feed reader, great stuff. Can not get enough! Youtube MP3 Converter
  25. Webdesign May 05, 2018
    I enjoyed reading your pleasant website. I see you offer priceless info. stumbled into this website by chance but I’m sure glad I clicked on that link. You definitely answered all the questions I’ve been dying to answer for some time now. Will definitely come back for more of this. Webdesign
  26. Händlerschutz May 05, 2018
    In todays news reporting clever journalists work their own slant into a story. Bloggers use it promote their works and many just use it for fun or to stay in touch with friends far away. Händlerschutz
  27. kenya luxury safari May 05, 2018
    I dont think Ive caught all the angles of this subject the way youve pointed them out. Youre a true star, a rock star man. Youve got so much to say and know so much about the subject that I think you should just teach a class about it kenya luxury safari
  28. maid of honor gift May 07, 2018
    Oh my goodness! an amazing article dude. Thank you Even so My business is experiencing problem with ur rss . Don’t know why Unable to subscribe to it. Can there be anyone obtaining identical rss problem? Anybody who knows kindly respond. Thnkx maid of honor gift
  29. acim lesson 1 May 07, 2018
    I am impressed by the quality of information on this website. There are a lot of good resources here. I am sure I will visit this place again soon. acim lesson 1
  30. a course in miracles May 08, 2018
    I was  rattling  delighted  to find this  internet site  on bing, just what I was looking  for : D  as well  saved to fav. a course in miracles
  31. distributor of business gift May 08, 2018
    I am really loving the theme/design of your website. Do you ever run into any internet browser compatibility issues? A few of my blog visitors have complained about my site not working correctly in Explorer but looks great in Safari. Do you have any tips to help fix this issue? distributor of business gift
  32. apeman a80 review May 08, 2018
    I really appreciate this post. I have been looking all over for this! Thank goodness I found it on Bing. You have made my day! Thanks again! apeman a80 review
  33. May 09, 2018
    This is really smart blog. I imply it. You have so much knowledge about this issue, and so good deal passion. You also know ideal make ladies rally behind it, obviously from the responses. Youve obtained a style here thats not too flashy, but makes a statement as big as what youre saying. Excellent work, indeed.
  34. ales May 09, 2018

    I as of late ran over your blog and have been perusing along. I figured I would leave my first remark

    Buy Gmail accounts

  35. canny-creations May 11, 2018
    you can always count on search engine marketing if you want to promote products online., canny-creations
  36. student firma firmadlakazdego May 11, 2018
    Do you accept guest posts? I would like to write couple articles here. student firma firmadlakazdego
  37. best clothes rack May 14, 2018
    You could definitely see your skills in the paintings you write. The arena hopes for more passionate writers like you who are not afraid to say how they believe. Always follow your heart. best clothes rack
  38. best garment rack May 15, 2018
    An fascinating discussion is worth comment. I do think that you ought to write read more about this topic, may possibly not certainly be a taboo subject but typically people are inadequate to communicate on such topics. To a higher. Cheers best garment rack
  39. thermo burn supplement May 15, 2018
    Hey there,  You have done a fantastic job. I will definitely digg it and personally suggest to my friends. I’m sure they will be benefited from this web site. thermo burn supplement
  40. than shisha May 15, 2018
    I would like to thnkx for the efforts you have put in writing this website. I’m hoping the same high-grade web site post from you in the upcoming as well. In fact your creative writing abilities has encouraged me to get my own site now. Actually the blogging is spreading its wings quickly. Your write up is a great example of it. than shisha
  41. sanvi May 16, 2018

    The enormous focal points are that the electronic diversion is more secure and significantly more helpful than the conventional amusement. The darts have plastic tips so they are less hazardous and are considerably less liable to place openings in your divider and I consider most us value the programmed scoring, particularly for the Cricket amusement.

    There are currently two kinds of professional electronic dart board around, the standard board with several gaps in it and the new alleged.

  42. Melissa Sirois May 16, 2018
    Be positive to trade matters up for the duration of your exercising to make the time skip too. For instance, every so often put your <a href="">bike</a> in a larger gear, stand up and pedal for 15-20 seconds.
  43. Nikki Jhon May 19, 2018

    Hybrid bikes are both do-it-all bikes or difficult-to-outline machine with precise abilities and capabilities. Hybrids take a seat in the hole between avenue bikes on one facet and mountain bikes on the other.

  44. Rogers Roy May 21, 2018
    While both corded and cordless reciprocating saws are smaller and compact, cordless choices have an edge since you don't need to connect them to an electrical attachment. Like different cordless power apparatuses, this gadget keeps running on batteries and does not require an augmentation attachment to work.
  45. kretyi Jun 02, 2018

    Electric sweepers are calmer and less demanding to use under odd circumstances, yet despite everything they should be connected to or revived, which can make it difficult to take them wherever you need. A manual best push lawn sweeper has none of these necessities and can be used a long way from development if you have to. That makes them a standout amongst the most helpful sorts of lawn sweeper available!

  46. Margaret Jun 10, 2018
    One of the numerous energizing highlights of these gadgets is the capacity to tweak them to serve your requirements better. If you arrange the best non-slip bath mats that are too extensive for your tub, you can pare it down with a normal combine of scissors. Like this, you can verify that you have the best fit for your specific tub, and the times of slipping while at the same time showering will be a relic of days gone by.
  47. sunhoun Jun 13, 2018

    Indeed a few people may have cordless electric weed eater all through their yard, yet if your yard is that enormous than I would modest far from electric weed whackers essentially do the absence of power expected to keep up a huge yard. Then other than the cost what else makes an electric weed whacker justified, despite all the trouble? Well, two primary reasons.

    Leave a comment