Hi
I have delevloped a Goodle like calendar that changes the back ground colour of the day cell dependent on a count of actions for that day (very like the google web history cal)
in the code behind there is a handler for the DayRender Event and the tooltip events as follows
All works fine untill I select a diary entry after this the tool tip still works but as the mouse moves over the other cells the background colour is reset.. Is there anyway I can use JS to keep the colour using a custom client side events.... or am i missing somthing else
Julian
I have delevloped a Goodle like calendar that changes the back ground colour of the day cell dependent on a count of actions for that day (very like the google web history cal)
<telerik:RadCalendar ID="DiaryCal" runat="server" Font-Names="Arial,Verdana,Tahoma" |
Skin="Office2007" |
ForeColor="Black" |
Style="border-color: #ececec" AutoPostBack="True" |
CultureInfo="English (United Kingdom)" |
EnableMultiSelect = "false" |
OnSelectionChanged="DiaryCal_OnSelectionChanged" |
OnDayRender="DiaryCal_DayRender" |
ShowDayCellToolTips="false" |
> |
</telerik:RadCalendar> |
<asp:Table ID="Table1" runat="server" CellSpacing="1" BorderWidth="0" Width="175"> |
<asp:TableRow ID="TableRow1" runat="server" > |
<asp:TableCell BackColor="#daf3cb" HorizontalAlign="Center" Width="25%" Height="8px"></asp:TableCell> |
<asp:TableCell BackColor="#aade8a" HorizontalAlign="Center" Width="25%" Height="8px"></asp:TableCell> |
<asp:TableCell BackColor="#6dc738" HorizontalAlign="Center" Width="25%" Height="8px"></asp:TableCell> |
<asp:TableCell BackColor="#4e991f" HorizontalAlign="Center" Width="25%" Height="8px"></asp:TableCell> |
</asp:TableRow> |
<asp:TableRow ID="TableRow2" runat="server"> |
<asp:TableCell HorizontalAlign="Center" Width="25%"> |
<asp:Label ID="Label1" runat="server" Text="1-10" /> |
</asp:TableCell> |
<asp:TableCell HorizontalAlign="Center" Width="25%"> |
<asp:Label ID="Label2" runat="server" Text="11-20" /> |
</asp:TableCell> |
<asp:TableCell HorizontalAlign="Center" Width="25%"> |
<asp:Label ID="Label3" runat="server" Text="21-30" /> |
</asp:TableCell> |
<asp:TableCell HorizontalAlign="Center" Width="25%"> |
<asp:Label ID="Label4" runat="server" Text="40+" /> |
</asp:TableCell> |
</asp:TableRow> |
</asp:Table> |
<telerik:RadToolTipManager ID="RadToolTipManager1" runat="server" ShowCallout="False" Skin="Office2007" style="display: none;" ShowDelay="0" />
|
in the code behind there is a handler for the DayRender Event and the tooltip events as follows
Protected Sub DiaryCal_DayRender(ByVal sender As Object, ByVal e As Telerik.Web.UI.Calendar.DayRenderEventArgs) |
Dim cellID As String |
cellID = String.Format("{0}_{1}_{2}", DiaryCal.ClientID, e.Day.[Date].ToString("yyyy_M_d"), 0) |
If DiaryCounts IsNot Nothing Then |
For Each diaryCount As Safe.CRM.DAL.BusinessObjects.DiaryCount In DiaryCounts ' contains a list of days and counts |
If diaryCount.ActivityCompleteBy = e.Day.Date Then |
Dim iCounts As Integer = diaryCount.Counts |
If iCounts >= 1 And iCounts <= 10 Then |
e.Cell.Style("background-color") = "#daf3cb" |
ElseIf iCounts >= 11 And iCounts <= 20 Then |
e.Cell.Style("background-color") = "#aade8a" |
ElseIf iCounts >= 21 And iCounts <= 30 Then |
e.Cell.Style("background-color") = "#6dc738" |
ElseIf iCounts >= 31 Then |
e.Cell.Style("background-color") = "#4e991f" |
End If |
cellID = String.Format("{0}_{1}_{2}", DiaryCal.ClientID, e.Day.[Date].ToString("yyyy_M_d"), iCounts) |
Exit For |
End If |
Next |
End If |
e.Cell.Attributes.Add("id", cellID) |
RadToolTipManager1.TargetControls.Add(cellID, True) |
End Sub |
Protected Sub RadToolTipManager1_AjaxUpdate(ByVal sender As Object, ByVal e As Telerik.Web.UI.ToolTipUpdateEventArgs) Handles RadToolTipManager1.AjaxUpdate |
' get the event date from the cell id |
Dim idParts As String() = e.TargetControlID.Split(New Char() {"_"c}) |
Dim year As Integer = Int32.Parse(idParts(idParts.Length - 4)) |
Dim month As Integer = Int32.Parse(idParts(idParts.Length - 3)) |
Dim day As Integer = Int32.Parse(idParts(idParts.Length - 2)) |
Dim eventDate As New DateTime(year, month, day) |
Dim items As Integer = Int32.Parse(idParts(idParts.Length - 1)) |
' display the proper content based on the event date |
Dim tooltipActivitesLabel As New Label() |
Dim tooltipDateLabel As New Label() |
Dim toolTipPanel As New Panel |
If items = 0 Then |
tooltipActivitesLabel.Text = "" |
ElseIf items = 1 Then |
tooltipActivitesLabel.Text = String.Format("{0} activity.", items) |
Else |
tooltipActivitesLabel.Text = String.Format("{0} activities.", items) |
End If |
tooltipDateLabel.Text = String.Format("{0}", eventDate.ToString(CType(DiaryCal, Telerik.Web.UI.RadCalendar).DayCellToolTipFormat)) |
If tooltipActivitesLabel.Text <> "" Then |
toolTipPanel.Controls.Add(tooltipActivitesLabel) |
toolTipPanel.Controls.Add(New LiteralControl("<br />")) |
End If |
toolTipPanel.Controls.Add(tooltipDateLabel) |
toolTipPanel.HorizontalAlign = HorizontalAlign.Center |
e.UpdatePanel.ContentTemplateContainer.Controls.Add(toolTipPanel) |
End Sub |
All works fine untill I select a diary entry after this the tool tip still works but as the mouse moves over the other cells the background colour is reset.. Is there anyway I can use JS to keep the colour using a custom client side events.... or am i missing somthing else
Julian