"na" <an********@yahoo.comwrote in message
news:11********************@k70g2000cwa.googlegrou ps.com...
Thanks, Mark. Now add one more twist. How do I disable the dates that
does not have record in a database? I hope I dont' have to connect to
the database and query it using the e.date as a parameter. It would be
too many connections and queries going on
No of course not - that would be ridiculous.
I do this by querying the database once to return all records between the
start and end date of the calendar (or calendars) on the page, which I then
store in a List<DateTimegeneric collection. Then, on the DayRender, I
simply check if the generic list contains the key e.Date.
pseudo-code:
List<DateTimemlstDates = new List<DateTime>;
Page_Init or Page_Load
{
<clear out mlstDates>;
SqlDataReader objDR = <SqlDataReader of dates>;
while (objDR.Read())
{
mlistDates.Add(<Date from SqlDataReader>);
}
}
Calendar_DayRender
{
if (!mlstDates.ContainsKey(e.Date))
{
// disable the date in the Calendar;
}
}