Someone sent me an email query about being able to select dates in the Calendar control and mark with them with different colors. They also wanted to persist the colors with the dates across postbacks. (This is not the exact scenario, but close enough.) Here's a picture:

There are two issues here. One is how to persist non-sequential selected dates across postbacks. I wrote about that a while back.
The second is the color thing. The issue is that when users click a date, the date should be colored according to the current radio button settings. But this information also needs to be persisted so that on postback the page can restore the color that was in force when the user clicked a date.
One solution is to create a type that contains both the date and the color it was set to. You then work with arrays (in my case, or generics if you're in Whidbey) of this type, storing them to viewstate between postbacks.
Here's the code I came up with. There's only one note of interest, namely that the ColorDate class has to be marked serializable so that it can be shoved into viewstate.Protected colorDateArrayList As ArrayList
Dim cd As ColorDate
Sub Page_Load()
If Viewstate("selectedColoredDates") Is Nothing Then
colorDateArrayList = New ArrayList()
Else
colorDateArrayList = CType(Viewstate("selectedColoredDates"), ArrayList)
For each cd in colorDateArrayList
Calendar1.SelectedDates.Add(cd.CDDate)
Next
End If
End Sub
Sub Calendar1_SelectionChanged(sender As Object, e As EventArgs)
AddToDates(Calendar1.SelectedDate)
End Sub
Sub AddToDates(newDate As DateTime)
Dim c As String
If radioGreen.Checked = True Then
c = Color.Green.ToKnownColor()
ElseIf radioYellow.Checked = True Then
c = Color.Yellow.ToKnownColor()
ElseIf radioBlue.Checked = true Then
c = Color.Blue.ToKnownColor()
End If
cd = New ColorDate(newDate,c)
Calendar1.SelectedDates.Add(cd.CDDate)
colorDateArrayList.Add(cd)
Viewstate("selectedColoredDates") = colorDateArrayList
End Sub
Sub Calendar1_DayRender(sender As Object, e As DayRenderEventArgs)
If Not colorDateArrayList Is Nothing Then
For each cd in colorDateArrayList
If e.Day.Date = cd.CDDate Then
e.Cell.BackColor = Color.FromKnownColor(cd.CDColor)
End If
Next
End If
End Sub
<Serializable()> Class ColorDate
Public CDDate As DateTime
Public CDColor As String
Public Sub New(dt As DateTime, c As String)
CDDate = dt
CDColor = c
End Sub
End Class