I am changing the background color of a date ( that is being provided from the database ) by using the Calendar OnDayRender. The problem is that when the page initially loads the background color is not present. But if I change the month, then go back to the previous month, the background color appears.
ASP:
<telerik:RadDatePicker AutoPostBack="true" OnSelectedDateChanged="rdpEnd_SelectedDateChanged" ID="rdpEnd" ToolTip="" class="form-control" Style="width: 100%;" Height="30px" aria-describedby="ptoEndDate" runat="server"><DatePopupButton ToolTip="" /><Calendar runat="server" ShowRowHeaders="false" OnDayRender="CustomizeDay"></Calendar></telerik:RadDatePicker>
C#
protected void CustomizeDay(object sender, Telerik.Web.UI.Calendar.DayRenderEventArgs e){ DateTime CurrentDate = e.Day.Date; using (DataClassesDataContext db = new DataClassesDataContext()) { if(db.Calendars.Where(x => x.date.Value.Date == e.Day.Date).Any()) { TableCell currentCell = e.Cell; currentCell.Style["background-color"] = "#000000"; } }}
