I have done this. Check out
http://www.Pack96.org/calendar. This calendar
reads from a SQL Server (although it could do it from Access as well)
database and in the calendar's DayRender event, populates the currently
rendering cell with a label with data from the DataBase. Here's a code
snippet:
Private Sub calPackEvents_DayRender(ByVal sender As System.Object, ByVal
e As System.Web.UI.WebControls.DayRenderEventArgs) Handles
calPackEvents.DayRender
Dim objLabel As New Label()
Try
'Determine the date of the rendering cell
RenderingCellDate = e.Day.Date.ToShortDateString
'Loop through all the events in the DataSet
For i = 0 To ds.EventData.Rows.Count - 1
'Check the event to see if it is for the day being rendered
EventDate = CType(ds.EventData.Rows(i).Item("EventDate"),
Date).ToShortDateString
'If the database event date is a date that is in the future
(greater than the day being rendered), move on...
If EventDate > RenderingCellDate Then Exit For
'Is there an event for the day being rendered in the
calendar
If EventDate = RenderingCellDate Then
'Go write the event data into the label
Call WriteEvent(e, i, objLabel)
End If
Next i
'Add the label to the rendering cell
If Not IsNothing(objLabel) Then e.Cell.Controls.Add(objLabel)
Catch MyErr As Exception
lblError.Text = MyErr.Message
End Try
End Sub
Sub WriteEvent(ByVal RenderingCell As
System.Web.UI.WebControls.DayRenderEventArgs, ByVal i As Integer, ByVal
objLabel As Label)
'My database has a field to record if the event is "special" or not
so it can be rendered in a different color than ordinary events
'Special events would be things like holidays and no school days
'If it's a special day, change its background color
If ds.EventData.Rows(i).Item("Special") Then
RenderingCell.Cell.BackColor = Color.Wheat
'What is the event we're rendering? EventName is the field name in
my DataBase that represents the event name
EventName = ds.EventData.Rows(i).Item("EventName")
'Check to see if there are details for the event & set up its value
If Not IsDBNull(ds.EventData.Rows(i).Item("Details")) Then
EventDetails = ds.EventData.Rows(i).Item("Details")
'When there are details for an event, make the event clickable
and have a JavaScript popup window show the details
'There are event details, so get the JS popup window ready
Dim PopUpWindowTitle As String = Replace(EventName, "<BR>", " ")
Dim PopupLink As String = "javascript

opUpWindow(" & Chr(34) &
EventDetails & Chr(34) & ")"
'Begin writing the event to the calendar
objLabel.Text += "<BR><A HREF='#' onClick='" & PopupLink & "'>"
& EventName & "</A><BR>"
Else
objLabel.Text += "<BR>" & EventName & "<BR>"
End If
End Sub
As far as the CSSClass property, my hunch is that the inline styles created
by the server side properties are overriding the CSSClass styles. Inline
style defiinitions always override page style and external styles.