I have a calendar control on my page and so far i have been able to set it up so that only 45 days worth are selectable. Now within those 45, i have 14days that i want to highlight so they know that those days are their current pay period.
This is what i have, but cant seem to figure out what im missing or not doing. I have a procedure that returns the 14 days i need to highlight those days when the calendar is rendered. My getPayPeriod() returns a list of 14 dates.
Here is my DayRender event
protected void DayRender(Object source, DayRenderEventArgs e) { // Change the background color of the days in the month. if (!e.Day.IsOtherMonth && !e.Day.IsWeekend) e.Cell.BackColor = System.Drawing.Color.Gray; DateTime dt = DateTime.Today.AddDays(30); DateTime minDate = Convert.ToDateTime(getPayPeriod()); if (e.Day.Date >= dt.Date) { e.Cell.BackColor = System.Drawing.Color.LightGray; e.Day.IsSelectable = false; e.Cell.ForeColor = System.Drawing.Color.LightGray; } else if (e.Day.Date <= minDate.Date) { e.Cell.BackColor = System.Drawing.Color.LightGray; e.Day.IsSelectable = false; e.Cell.ForeColor = System.Drawing.Color.LightGray; } else { e.Cell.BackColor = System.Drawing.Color.WhiteSmoke; e.Day.IsSelectable = true; } if (e.Day.IsSelected) { e.Cell.BackColor = System.Drawing.Color.Red; e.Cell.Style.Add("font-weight", "bold"); e.Cell.Style.Add("color", "black"); } }