Hi Im building a calendar in which the headline of the entry is showed up and opon hover the radtooltip shows up..
In order to do that I'm assuming I have to create a custom template for every entry since what shows up on the calendar is the id for each template...
I have created database tables and have a loop that adds the special days to the radCalendar control:
when I run this it does fill the grid but it puts the date of the cell on each cell of the calendar which is not what I want.
Then Also I have grabbed this piece of code from your website that implements Itemplate to add the template to the Grid
In order to do that I'm assuming I have to create a custom template for every entry since what shows up on the calendar is the id for each template...
I have created database tables and have a loop that adds the special days to the radCalendar control:
when I run this it does fill the grid but it puts the date of the cell on each cell of the calendar which is not what I want.
Do
While
dr.Read()
Dim
d
As
New
DateTime()
Dim
s
As
String
=
""
Dim
NewDay
As
New
RadCalendarDay(RadCalendar1)
'---------------------------------Date
If
Not
IsDBNull(dr(
"evnDate"
))
Then
d = dr(
"evnDate"
)
Else
d = System.DateTime.Now
End
If
NewDay.
Date
=
New
DateTime(d.Year, d.Month, d.Day)
'---------------------------------Repeat
If
Not
IsDBNull(dr(
"evnRepeats"
))
Then
s = dr(
"evnRepeats"
)
End
If
Select
Case
s
Case
"Monthly"
NewDay.Repeatable = RecurringEvents.DayAndMonth
Case
"Daily"
NewDay.Repeatable = RecurringEvents.DayInMonth
Case
"Weekly"
NewDay.Repeatable = RecurringEvents.Week
Case
""
NewDay.Repeatable = RecurringEvents.None
End
Select
'-------------------------------------Tooltip
If
Not
IsDBNull(dr(
"evnToolTip"
))
Then
NewDay.ToolTip = dr(
"evnToolTip"
)
End
If
'-------------------------------------TemplateID, but first Create TEmplate,
' in order to create template create div
'Dim newT As New DayTemplate()
'newT.Controls.Add(cDiv)
'newT.ID = cDiv.InnerHtml.Replace(" ", "")
'If RadCalendar1.CalendarDayTemplates.Contains(newT) Then
' RadCalendar1.CalendarDayTemplates.Add(newT)
'End If
'NewDay.TemplateID = newT.ID
'RadCalendar1.SpecialDays.Add(NewDay)
Dim
cDiv
As
New
System.Web.UI.HtmlControls.HtmlGenericControl(
"DIV"
)
cDiv.Attributes(
"class"
) =
"rcTemplate rcDayMortgage"
If
Not
IsDBNull(dr(
"evnTemplateID"
))
Then
cDiv.InnerHtml = dr(
"evnTemplateID"
)
ElseIf
dr(
"evnTemplateID"
) =
""
Then
cDiv.InnerHtml =
"Calendar Entry"
Else
cDiv.InnerHtml =
"Calendar Entry"
End
If
cDiv.ID = cDiv.InnerText
Dim
template
As
New
CalendarCellContentTemplate(RadCalendar1, d, cDiv, NewDay.Repeatable)
Then Also I have grabbed this piece of code from your website that implements Itemplate to add the template to the Grid
Public
Class
CalendarCellContentTemplate
Implements
ITemplate
Private
cellContent
As
Control
Public
Sub
New
(
ByVal
calendarInstance
As
RadCalendar,
ByVal
cellDate
As
DateTime,
ByVal
cellContent
As
Control, _
ByVal
repeat
As
Telerik.Web.UI.Calendar.RecurringEvents)
Dim
spec
As
RadCalendarDay
Me
.cellContent = cellContent
spec = calendarInstance.SpecialDays(calendarInstance.SpecialDays.IndexOf(cellDate))
If
spec
Is
Nothing
Then
spec =
New
RadCalendarDay()
spec.
Date
= cellDate
spec.TemplateID =
"BirthdayTemplate"
calendarInstance.SpecialDays.Add(spec)
End
If
Dim
template
As
New
DayTemplate
template.ID = cellContent.ID
template.Content =
Me
spec.Repeatable = repeat
calendarInstance.CalendarDayTemplates.Add(template)
End
Sub
Public
Sub
InstantiateIn(
ByVal
container
As
System.Web.UI.Control)
Implements
System.Web.UI.ITemplate.InstantiateIn
container.Controls.Add(
Me
.cellContent)
End
Sub
End
Class