Day Cell colour issues

9 posts, 0 answers
  1. julian Welby Everard
    julian Welby Everard avatar
    13 posts
    Member since:
    Mar 2009

    Posted 24 Mar 2009 Link to this post

    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)

    <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
  2. Iana Tsolova
    Admin
    Iana Tsolova avatar
    3388 posts

    Posted 30 Mar 2009 Link to this post

    Hi julian,

    Could you please elaborate a bit on your scenario? Is your calendar ajaxified? And are you using RadAjax or MS UpdatePanels to ajaxify it?

    Regards,
    Iana
    the Telerik team

    Check out Telerik Trainer , the state of the art learning tool for Telerik products.
  3. julian Welby Everard
    julian Welby Everard avatar
    13 posts
    Member since:
    Mar 2009

    Posted 30 Mar 2009 Link to this post

    Hi

    We use an RadAjaxManager  to ajax the control. Also the control sits on the master page,

    The ajax calls to update the schedular when a date is clicked, and the radtool tip work when the mouse hovers, its after the date click that the problem seems to happen. that the cells are set to white when the mouse hovers over them,

    Julian
  4. Iana Tsolova
    Admin
    Iana Tsolova avatar
    3388 posts

    Posted 01 Apr 2009 Link to this post

    Hi julian,

    I suggest that you use MS UpdatePanel to ajaxify your RadScheduler instead of RadAjaxManager. Unfortunately there is an issue with the calendar cell styles set on DayRender after ajax request is performed, when RadCalendar is ajaxified with RadAjaxManager (you can check it out here). We are working on it but still we have not found a resolution.

    Please excuse us for the inconvenience.

    Best wishes,
    Iana
    the Telerik team

    Check out Telerik Trainer , the state of the art learning tool for Telerik products.
  5. spt
    spt avatar
    36 posts
    Member since:
    Sep 2007

    Posted 09 Feb 2010 Link to this post

    Have you any progress with this issue?
  6. Iana Tsolova
    Admin
    Iana Tsolova avatar
    3388 posts

    Posted 10 Feb 2010 Link to this post

    Hi spt,

    Please try getting the latest version of RadControls for ASP.NET AJAX and try it out.
    Let me know if the issue persists.

    Greetings,
    Iana
    the Telerik team

    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
    Follow the status of features or bugs in PITS and vote for them to affect their priority.
  7. spt
    spt avatar
    36 posts
    Member since:
    Sep 2007

    Posted 10 Feb 2010 Link to this post

    I have RadControls_for_ASP.NET_AJAX_2009_3_1208.
    Issue persists.
  8. spt
    spt avatar
    36 posts
    Member since:
    Sep 2007

    Posted 11 Feb 2010 Link to this post

    Sorry, just now I installed the latest RadControls_for_ASP.NET_AJAX_2009_3_1314, this bug was fixed. Thanks
  9. Iana Tsolova
    Admin
    Iana Tsolova avatar
    3388 posts

    Posted 12 Feb 2010 Link to this post

    Hi spt,

    Thank you for sharing your findings with the community.

    Indeed, the current official version of RadControls for ASP.NET AJAX is labeled 2009.3.1314. And the fix for the mentioned issue is available there as you already found.

    All the best,
    Iana
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Back to Top