I have two schedulers. One is for users to populate with appointments. The second one is public facing. They both share the same data source though. For the public facing, as the scheduler loads and populates events I need to do the following:
- check the appointment subject. (For simplicity) If the subject is "A" then I set the background image of the cell to a color and an image
- if the subject is "B" I set it to another image and color
- I need to set the whole background image of the cell in month view. Not the background image and color for the appointment. The whole cell.
- I need to then also make the appointment invisible so that only the color and image remain.
I tried doing this in the OnAppointmentCreated event. I have the code below but this only sets the color of the appointment and not the whole cell. It also for some reason does not hide the appointment. Any help would be appreciated.
protected void RadScheduler1_AppointmentCreated(object sender, Telerik.Web.UI.AppointmentCreatedEventArgs e)
{
if(e.Appointment.Subject.ToString() == "A")
{
e.Appointment.CssClass = "Custom";
e.Appointment.Visible = false;
}
}
the css:
<style type="text/css">
.Custom .rsAptOut
{
background-color: Blue !important;
}
</style>
- check the appointment subject. (For simplicity) If the subject is "A" then I set the background image of the cell to a color and an image
- if the subject is "B" I set it to another image and color
- I need to set the whole background image of the cell in month view. Not the background image and color for the appointment. The whole cell.
- I need to then also make the appointment invisible so that only the color and image remain.
I tried doing this in the OnAppointmentCreated event. I have the code below but this only sets the color of the appointment and not the whole cell. It also for some reason does not hide the appointment. Any help would be appreciated.
protected void RadScheduler1_AppointmentCreated(object sender, Telerik.Web.UI.AppointmentCreatedEventArgs e)
{
if(e.Appointment.Subject.ToString() == "A")
{
e.Appointment.CssClass = "Custom";
e.Appointment.Visible = false;
}
}
the css:
<style type="text/css">
.Custom .rsAptOut
{
background-color: Blue !important;
}
</style>
6 Answers, 1 is accepted
0
Hello Dan,
You can try to handle the TimeSlotCrerated event :
CSS code is:
Hope this is helpful.
Best wishes,
Plamen Zdravkov
the Telerik team
You can try to handle the TimeSlotCrerated event :
protected
void
RadScheduler1_TimeSlotCreated(
object
sender, TimeSlotCreatedEventArgs e)
{
foreach
(Appointment app
in
RadScheduler1.Appointments)
{
if
(app.Start>=e.TimeSlot.Start && app.Start<=e.TimeSlot.End)
{
if
(app.Subject==
"A"
)
{
e.TimeSlot.CssClass =
"Custom"
;
app.Visible =
false
;
}
}
}
}
.Custom
{
background-color
: Blue
!important
;
}
Hope this is helpful.
Best wishes,
Plamen Zdravkov
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0
Dan
Top achievements
Rank 1
answered on 29 Jul 2011, 06:54 PM
Thanks for that Plamen. This works somewhat. It does mark the days with appointments but it also hits for the day before. So if there is a Wednesday appointment it also colours the cell on the tuesday. Must be something to do with the date comparison and I'll try and figure that out.
However, the main problem with this solution is that when I click on the next month arrow it seems to cycle through the currently displayed month. Therefore when the next month paints to screen there are no highlighted appointments. This seems to only be an issue with recursive appointments on the subsequent months. If the appointment is a standalone on the next month it will behave as expected. Any ideas how to get around that one?
Thanks,
Dan
However, the main problem with this solution is that when I click on the next month arrow it seems to cycle through the currently displayed month. Therefore when the next month paints to screen there are no highlighted appointments. This seems to only be an issue with recursive appointments on the subsequent months. If the appointment is a standalone on the next month it will behave as expected. Any ideas how to get around that one?
Thanks,
Dan
0
Dan
Top achievements
Rank 1
answered on 29 Jul 2011, 06:59 PM
Actually I figured out the first issue of the extra day being added before the correct day. There was a typo
Should have been app.End - so that part works now.
Still have the issue when I move to the next month though that the appointments are not shown/searched. I guess I need a way to tell Radscheduler to advance a month?
if
(app.Start>=e.TimeSlot.Start && app.Start<=e.TimeSlot.End)
Should have been app.End - so that part works now.
Still have the issue when I move to the next month though that the appointments are not shown/searched. I guess I need a way to tell Radscheduler to advance a month?
0
Dan
Top achievements
Rank 1
answered on 02 Aug 2011, 04:06 PM
Okay, I now only have one minor issue with this. I have all the appointment cells colouring now which is awesome. I found a bug in my code so that is resolved.
Remaining issue: The app.Visible = false; line of code in Plamen's initial response does not make the appointment invisible. Any ideas why? Is there somewhere else I can call this logic to make the appointment invisible? I figure the reason it does not make it invisible is because when the
Thanks,
Dan
Remaining issue: The app.Visible = false; line of code in Plamen's initial response does not make the appointment invisible. Any ideas why? Is there somewhere else I can call this logic to make the appointment invisible? I figure the reason it does not make it invisible is because when the
RadScheduler1_TimeSlotCreated
event runs the appointment doesn't actually exist yet. At least when I step through the code that is how the timing appears. I tried in AppointmentCreated as below but no luck.protected
void
RadScheduler1_AppointmentCreated(
object
sender, Telerik.Web.UI.AppointmentCreatedEventArgs e)
{
e.Appointment.Visible =
false
;
}
Thanks,
Dan
0
Dan
Top achievements
Rank 1
answered on 02 Aug 2011, 06:23 PM
Final reply: you set the visibility in the AppointmentDataBound event
That's all my formatting issues resolved, finally!
protected
void
RadScheduler1_AppointmentDataBound(
object
sender, SchedulerEventArgs e)
{
e.Appointment.Visible =
false
;
}
That's all my formatting issues resolved, finally!
0
Hello Dan,
Thanks for sharing your findings in the forum.
All the best,
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.