Yes this exception is obvious, because
dtholidays
is null. You check for null before using the variable. Try this:
if(dtholidays != null){
if (dtholidays.Contains(e.Day.Date))
{
e.Cell.BackColor = System.Drawing.Color.Green;
}
}
As I can see your code,
dtholidays
is class level variable and it'll be reassigned on every postback and this will become null. Better, you store this list to session and whenever required fetch it from session.
--Amit