Imports Telerik.Web.UI
Imports System.Collections.Generic
Imports System.Drawing

Partial Class RadSchedulerDynamicResourceLoading
    Inherits System.Web.UI.Page

    Private m_Rnd As New Random

    Public Function RandomRGBColor() As Color
        Return Color.FromArgb(255, _
            m_Rnd.Next(0, 255), _
            m_Rnd.Next(0, 255), _
            m_Rnd.Next(0, 255))
    End Function

    Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
        ResourceStyles()
    End Sub


    Protected Sub ResourceStyles()
        For Each res As Resource In RadScheduler1.Resources.GetResourcesByType("User")
            Dim resMapping As New ResourceStyleMapping()
            resMapping.Key = res.Key.ToString()
            resMapping.BackColor = RandomRGBColor()

            RadScheduler1.ResourceStyles.Add(resMapping)
        Next
    End Sub

End Class
