I've got a calendar that has CalendarDayTemplates created dynamically on load and then assigns each one to a SpecialDay in the calendar. Please see below.
This works great when the page is not postback, but on any postback I get this error:
System.Exception: Template with ID: 0 not found.
I'm assuming that's because the first special day rendered has a TemplateID of 0, which is not being persisted.
Is this expected functionality? Is there a workaround without re-running the above?
If Not IsPostBack Then |
Dim i as Integer = 0 |
For Each d As RadDate In cal.SelectedDates |
dvTimespots.RowFilter = "startdate <= #" & d.Date & "# AND enddate >= #" & d.Date & "#" |
Dim cdt As New CalendarDayTemplate(d.Date.Day, dvTimespots.Count & " media item(s)") |
Dim dt As New DayTemplate |
With dt |
.Content = cdt |
.ID = i |
End With |
cal.CalendarDayTemplates.Add(dt) |
Dim rcd As New RadCalendarDay |
With rcd |
.Date = d.Date |
.TemplateID = i |
End With |
cal.SpecialDays.Add(rcd) |
i += 1 |
Next End If |
This works great when the page is not postback, but on any postback I get this error:
System.Exception: Template with ID: 0 not found.
I'm assuming that's because the first special day rendered has a TemplateID of 0, which is not being persisted.
Is this expected functionality? Is there a workaround without re-running the above?