This is a migrated thread and some comments may be shown as answers.

e.Appointment.BackColor not Working.

1 Answer 75 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
L
Top achievements
Rank 1
L asked on 23 Apr 2011, 09:21 AM
hi

This is my code:

<ResourceTypes>
                     <telerik:ResourceType DataSourceID="sdsUsers" ForeignKeyField="UserID"
                         KeyField="UserID" Name="User_Name" TextField="User_Name" />
</ResourceTypes>

    Protected Sub RadScheduler1_AppointmentDataBound(ByVal sender As Object, ByVal e As Telerik.Web.UI.SchedulerEventArgs) Handles RadScheduler1.AppointmentDataBound
        If e.Appointment.Resources.GetResourceByType("User_Name") IsNot Nothing Then
            e.Appointment.BackColor = DataBinder.Eval(e.Appointment.Resources.GetResourceByType("User_Name").DataItem, "BackColor")
        End If
    End Sub

My user table schema:

UserID
User_Name
BackColor

I still do not get any color for the scheduler. What went wrong with my setting?

1 Answer, 1 is accepted

Sort by
0
Veronica
Telerik team
answered on 26 Apr 2011, 09:04 AM
Hi L,

Did the DataBinder.Eval(e.Appointment.Resources.GetResourceByType("User_Name").DataItem, "BackColor") expression returns any color? As another option I'll suggest you to use Custom Attributes to store the BackColor property for each appointment and later you can use code similar to the following to set the BackColor:

Protected Sub RadScheduler1_AppointmentDataBound(sender As Object, e As Telerik.Web.UI.SchedulerEventArgs)
    If e.Appointment.Resources.GetResourceByType("User_Name") IsNot Nothing Then
        e.Appointment.BackColor = e.Attributes("BackColor")
    End If
End Sub

Hope this helps.

Greetings,
Veronica Milcheva
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.

Tags
Scheduler
Asked by
L
Top achievements
Rank 1
Answers by
Veronica
Telerik team
Share this question
or