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

Matching the Resource Color and Header for that Resource in Grouping

2 Answers 74 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
greg
Top achievements
Rank 1
greg asked on 30 Sep 2015, 06:30 PM

I'm trying to get the color of the appointment for a resource and the header when using grouping to match also. I can set the colors of both but not using the built-in css styles.

Sub Page_Load

        sqlConn.Open()
        sqlDataRdr = sqlCmd.ExecuteReader()
    RadScheduler1.ResourceStyles.Clear()

        Do While sqlDataRdr.Read()

            If Not System.DBNull.Value.Equals(sqlDataRdr.Item("ID")) Then
                    RadScheduler1.ResourceStyles.Add(New ResourceStyleMapping("Calendar", sqlDataRdr.Item("ID"), sqlDataRdr.Item("colorStyle")))
            End If
        Loop
        sqlConn.Close()​

 

2 Answers, 1 is accepted

Sort by
0
greg
Top achievements
Rank 1
answered on 30 Sep 2015, 06:33 PM

Here is the Header color changing. I'd like to use the built-in css styles (rsCategoryViolet) but am unsure how to set that. Here is the manual way.

    Protected Sub RadScheduler1_ResourceHeaderCreated(sender As Object, e As ResourceHeaderCreatedEventArgs)

        Dim user As Label = TryCast(e.Container.FindControl("ResourceLabel"), Label)
        Dim resourceDiv As HtmlGenericControl = TryCast(e.Container.FindControl("ResourceDiv"), HtmlGenericControl)
        user.Text = e.Container.Resource.Text

        If user.Text = "Greg" Then
            resourceDiv.Style.Add("Background", "Red")
            resourceDiv.Style.Add("color", "white")
        End If

    End Sub

0
Ivan Danchev
Telerik team
answered on 05 Oct 2015, 03:41 PM
Hello,

I am afraid the built-in classes and their styles are not applicable to the ResourceHeader and are to be applied to the appointments only as shown in the Setting Styles for Appointments article where the class is set to the Appointment's CssClass property in the AppointmentDataBound handler. 
In order to set the ResourceHeaders' styles you can use an approach similar to the one shown in the Resource Grouping demo and set custom Classes to the element/elements in your ResourceHeaderTemplate (Panels, divs, etc.). These classes can use some of the styles (background-color and color for instance) of the built in Appointment CssClasses, which will help you the desired matching appearance of Appointments and Header.

Regards,
Ivan Danchev
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
Scheduler
Asked by
greg
Top achievements
Rank 1
Answers by
greg
Top achievements
Rank 1
Ivan Danchev
Telerik team
Share this question
or