e.Appointment.BackColor not Working.

2 posts, 0 answers
  1. L
    L avatar
    298 posts
    Member since:
    Apr 2008

    Posted 23 Apr 2011 Link to this post


    This is my code:

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

        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:


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

  2. Veronica
    Veronica avatar
    1213 posts

    Posted 26 Apr 2011 Link to this post

    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.

    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.

Back to Top