|
| 1 | +--- |
| 2 | +title: Displaying Appointment Count in RadScheduler MonthView |
| 3 | +description: Learn how to show the count of appointments for each day in the MonthView of the RadScheduler for UI for ASP.NET AJAX. |
| 4 | +type: how-to |
| 5 | +page_title: Setting Up Daily Appointment Counts in RadScheduler MonthView |
| 6 | +meta_title: Setting Up Daily Appointment Counts in RadScheduler MonthView |
| 7 | +slug: scheduler-monthview-daily-appointment-count |
| 8 | +tags: scheduler, ui for asp.net ajax, timeslotcreated, monthview, daily appointment count |
| 9 | +res_type: kb |
| 10 | +ticketid: 1695244 |
| 11 | +--- |
| 12 | + |
| 13 | +## Environment |
| 14 | + |
| 15 | +<table> |
| 16 | +<tbody> |
| 17 | +<tr> |
| 18 | +<td>Product</td> |
| 19 | +<td>Scheduler for UI for ASP.NET AJAX</td> |
| 20 | +</tr> |
| 21 | +<tr> |
| 22 | +<td>Version</td> |
| 23 | +<td>All</td> |
| 24 | +</tr> |
| 25 | +</tbody> |
| 26 | +</table> |
| 27 | + |
| 28 | +## Description |
| 29 | + |
| 30 | +I want to show the count of appointments for each day in the MonthView of the RadScheduler control for UI for ASP.NET AJAX. My stored procedure also returns the daily count, so I need guidance for either using the built-in appointment count or mapping my stored procedure results. |
| 31 | + |
| 32 | +This knowledge base article also answers the following questions: |
| 33 | + |
| 34 | +- How to customize RadScheduler MonthView cells? |
| 35 | +- How to display appointment counts using RadScheduler TimeSlotCreated? |
| 36 | + |
| 37 | +## Solution |
| 38 | + |
| 39 | +Use the [TimeSlotCreated](https://www.telerik.com/products/aspnet-ajax/documentation/controls/scheduler/server-side-programming/server-events/timeslotcreated) server-side event to customize each day cell in the MonthView of the RadScheduler. You can use `e.TimeSlot.Appointments.Count` to display the count of built-in appointments or map the results of your stored procedure to show the daily count. |
| 40 | + |
| 41 | +Example Using Built-In Appointment Count |
| 42 | + |
| 43 | +````C# |
| 44 | +protected void RadScheduler1_TimeSlotCreated(object sender, TimeSlotCreatedEventArgs e) |
| 45 | +{ |
| 46 | + if (RadScheduler1.SelectedView == SchedulerViewType.MonthView) |
| 47 | + { |
| 48 | + int count = e.TimeSlot.Appointments.Count; |
| 49 | + |
| 50 | + if (count > 0) |
| 51 | + { |
| 52 | + RadLabel lbl = new RadLabel() |
| 53 | + { |
| 54 | + Text = $"<div>{count}</div>", |
| 55 | + CssClass = "daily-count-label", |
| 56 | + }; |
| 57 | + |
| 58 | + e.TimeSlot.Control.Controls.Add(lbl); // Add label to the day cell |
| 59 | + } |
| 60 | + } |
| 61 | +} |
| 62 | +```` |
| 63 | + |
| 64 | +Example Styling for Appointment Count |
| 65 | + |
| 66 | +````CSS |
| 67 | +.daily-count-label { |
| 68 | + background-color: red; |
| 69 | + border-radius: 50%; |
| 70 | + color: white; |
| 71 | + padding: 5px; |
| 72 | +} |
| 73 | +```` |
| 74 | + |
0 commit comments