Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Development Tools
 ASP.NET
 shade date range in cal control?

Author  Topic 

jhermiz

3564 Posts

Posted - 2008-01-31 : 13:23:01
Assume I have 2 calendars calStart and calEnd
calStart's currently selected date is 1/31/2007 and calEnd's selected date is february 8. Is there a way to shade this date range in the calendar controls so that from January 31st till Feb 8th each cell has a background color ?

Thanks,
Jon


Weblog -- [url]http://weblogs.sqlteam.com/jhermiz[/url]

jhermiz

3564 Posts

Posted - 2008-02-02 : 23:30:48
quote:
Originally posted by jhermiz

Assume I have 2 calendars calStart and calEnd
calStart's currently selected date is 1/31/2007 and calEnd's selected date is february 8. Is there a way to shade this date range in the calendar controls so that from January 31st till Feb 8th each cell has a background color ?

Thanks,
Jon


Weblog -- [url]http://weblogs.sqlteam.com/jhermiz[/url]



I guess I could do this in the prerender event as well:


Protected Sub Calendar1_DayRender(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DayRenderEventArgs) Handles Calendar1.DayRender
Dim dStart As Date
Dim dEnd As Date

dEnd = Me.Calendar2.SelectedDate
dStart = Me.Calendar1.SelectedDate

If IsDate(dEnd) And IsDate(dStart) Then
If dEnd > dStart Then
If e.Day.Date >= dStart And e.Day.Date <= dEnd Then
e.Cell.BackColor = Drawing.Color.Blue
End If
End If
End If

End Sub




Weblog -- [url]http://weblogs.sqlteam.com/jhermiz[/url]
Go to Top of Page
   

- Advertisement -