Matching the Resource Color and Header for that Resource in Grouping

3 posts, 0 answers
  1. greg
    greg avatar
    2 posts
    Member since:
    Sep 2015

    Posted 30 Sep 2015 Link to this post

    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

            sqlDataRdr = sqlCmd.ExecuteReader()

            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


  2. greg
    greg avatar
    2 posts
    Member since:
    Sep 2015

    Posted 30 Sep 2015 in reply to greg Link to this post

    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

  3. Ivan Danchev
    Ivan Danchev avatar
    1302 posts

    Posted 05 Oct 2015 Link to this post


    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.

    Ivan Danchev
    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
Back to Top