I'm reading the appointments form a datatable. Here is my code:
List<MyClass> myObjects = (from e in myEntities.Mytable where
e.DateFrom >= schedulerInfo.ViewStart &&
e.DateTo <= schedulerInfo.ViewEnd
select e).ToList();
List<Appointment> appointments = new List<Appointment>(myObjects.Count);
foreach (MyClass e in myObjects) {
Appointment a = new Appointment();
a.ID = e.ID;
a.Subject = e.Description;
a.Start = e.DateFrom;
a.End = e.DateTo;
a.BackColor = System.Drawing.Color.Yellow;
appointments.Add(a);
and when I run it, it isn't yellow!
List<MyClass> myObjects = (from e in myEntities.Mytable where
e.DateFrom >= schedulerInfo.ViewStart &&
e.DateTo <= schedulerInfo.ViewEnd
select e).ToList();
List<Appointment> appointments = new List<Appointment>(myObjects.Count);
foreach (MyClass e in myObjects) {
Appointment a = new Appointment();
a.ID = e.ID;
a.Subject = e.Description;
a.Start = e.DateFrom;
a.End = e.DateTo;
a.BackColor = System.Drawing.Color.Yellow;
appointments.Add(a);
and when I run it, it isn't yellow!
6 Answers, 1 is accepted
0
Hello Dani,
You need to use Custom Attributes to store the BackColor value and then handle AppointmentDataBound to set the BackColor property for the appointment from its custom attribute. You can see this demo as reference - http://demos.telerik.com/aspnet-ajax/scheduler/examples/advancedformtemplate/defaultcs.aspx.
Greetings, Peter
the Telerik team
You need to use Custom Attributes to store the BackColor value and then handle AppointmentDataBound to set the BackColor property for the appointment from its custom attribute. You can see this demo as reference - http://demos.telerik.com/aspnet-ajax/scheduler/examples/advancedformtemplate/defaultcs.aspx.
Greetings, Peter
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
0

Dani
Top achievements
Rank 1
answered on 13 Dec 2011, 09:08 AM
I added the AppointmentDataBound event but it never gets called.
I put breakpoint in its beginning and it's never hit.
I put breakpoint in its beginning and it's never hit.
0
Hello Dani,
AppointmentDataBound will not fire if you use a Web Service to populate RadScheduler. In this case you should handle OnClientAppointmentDataBound like this:
You can download a working sample from here (WebServiceBinding).
Greetings, Peter
the Telerik team
AppointmentDataBound will not fire if you use a Web Service to populate RadScheduler. In this case you should handle OnClientAppointmentDataBound like this:
function
OnClientAppointmentDataBound(sender, eventArgs) {
var
app = eventArgs.get_appointment();
//debugger;
var
backColor = app.get_attributes().getAttribute(
"AppointmentColor"
);
if
(backColor)
app.set_backColor(backColor);
app.set_borderColor(
"black"
);
app.set_borderWidth(
"1"
);
}
You can download a working sample from here (WebServiceBinding).
Greetings, Peter
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
0

Dani
Top achievements
Rank 1
answered on 13 Dec 2011, 04:06 PM
Thanks very much for your response.
I now have another problem.
Here is the code for my method:
<script type="text/javascript">
function OnClientAppointmentDataBound(sender, eventArgs) {
var app = eventArgs.get_appointment();
if (app.get_attributes().getAttribute("myAttr") == false.toString()) {
app.set_borderColor("black");
app.set_borderWidth("1");
}
}
</script>
and it isn't working!
What I'm trying to do is set every cell which has myAttribute == true, set its background color to red.
I now have another problem.
Here is the code for my method:
<script type="text/javascript">
function OnClientAppointmentDataBound(sender, eventArgs) {
var app = eventArgs.get_appointment();
if (app.get_attributes().getAttribute("myAttr") == false.toString()) {
app.set_borderColor("black");
app.set_borderWidth("1");
}
}
</script>
and it isn't working!
What I'm trying to do is set every cell which has myAttribute == true, set its background color to red.
0
Hello Dani,
Can you modify the sample from the code library entry so that the problem occurs and send it back to us to inspect it. We need to have a working sample to test to be able to say what is causing the problem.
Best wishes, Peter
the Telerik team
Can you modify the sample from the code library entry so that the problem occurs and send it back to us to inspect it. We need to have a working sample to test to be able to say what is causing the problem.
Best wishes, Peter
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
0

Dani
Top achievements
Rank 1
answered on 13 Dec 2011, 04:57 PM
Actually your previous answer worked. Tnx :)