AUTHOR: Peter Milchev
DATE POSTED: November 21, 2018
Apply custom HTML attributes to the HTML element generated by the appointment.
Using "title" as a key for the Attributes collection of the appointment is not allowed and in order to manipulate the "title" attribute of the rendered appointment, you should set the .ToolTip property.
For the other attributes, you can use the following JavaScript executed in the Sys.Application.Load event.
<%-- https:
//docs.telerik.com/devtools/aspnet-ajax/controls/window/troubleshooting/executing-javascript-code-from-server#when-using-aspnet-ajax --%>
<telerik:RadCodeBlock runat=
"server"
>
<script>
function
pageLoadHandler() {
var
scheduler = $find(
"<%= RadScheduler1.ClientID %>"
);
scheduler.get_appointments().forEach(
(apt) {
attributes = apt.get_attributes();
attributes.forEach(
(key, value) {
apt.get_element().setAttribute(key, value);
});
})
// Sys.Application.remove_load(pageLoadHandler);
}
Sys.Application.add_load(pageLoadHandler);
</script>
</telerik:RadCodeBlock>
<
telerik:RadScheduler
RenderMode
=
"Lightweight"
Font-Size
"14px"
SelectedDate
"2018-11-21"
runat
ID
"RadScheduler1"
OnAppointmentDataBound
"RadScheduler1_AppointmentDataBound"
</
protected
void
Page_Init(
object
sender, EventArgs e)
{
RadScheduler1.Provider =
new
Telerik.Web.UI.XmlSchedulerProvider(Server.MapPath(
"~/App_Data/Appointments.xml"
),
true
RadScheduler1_AppointmentDataBound(
sender, SchedulerEventArgs e)
e.Appointment.Attributes.Add(
"data-toggle"
,
"tooltip"
"data-placement"
"right"
e.Appointment.ToolTip =
"Radscheduler is the best!"
;
<?
xml
version
"1.0"
encoding
"utf-8"
?>
Appointments
NextID
>2</
Appointment
>1</
Subject
>Breakfast</
Start
>2018-11-21T08:30Z</
End
>2018-11-21T10:00Z</
Resources Buy Try