RadCalendar with Prometheus RadToolTips

Thread is closed for posting
7 posts, 0 answers
  1. 63F75A2C-1F16-4AED-AFE8-B1BBD57646AD
    63F75A2C-1F16-4AED-AFE8-B1BBD57646AD avatar
    1572 posts
    Member since:
    Oct 2004

    Posted 01 Jun 2007 Link to this post

    Requirements

    RadControls version

    RadCalendar 2.1.1
    RadToolTip Prometheus Beta
    .NET version

    2.0
    Visual Studio version

    2005
    programming language

    C# / VB.NET
    browser support

    all browsers supported by RadControls


     
    PROJECT DESCRIPTION
    This project demonstrates how to display a RadTooltip with custom event data over specific calendar days instead of showing the regular tooltip.

    In order to achieve the desired functionality you need to handle the DayRender server-side event of RadCalendar and set up the target controls of the tooltip manager there. By default the calendar cells do not have an identifier set so you need to assign them one first and then pass it to the tooltip manager like this:

    C#
    protected void RadCalendar1_DayRender(object sender, Telerik.WebControls.Base.Calendar.Events.DayRenderEventArgs e) 
        if (e.Day.Date == DateTime.Today || e.Day.Date == DateTime.Today.AddDays(1)) 
        { 
            string cellID = string.Format("{0}_{1}", RadCalendar1.ClientID, e.Day.Date.ToString("yyyy_M_d")); 
            // you need to assign an identifier for every cell that you would like to "tooltipify" 
            e.Cell.Attributes.Add("id", cellID); 
            RadToolTipManager1.TargetControls.Add(cellID, true); 
        } 

    VB.NET
    Protected Sub RadCalendar1_DayRender(ByVal sender As ObjectByVal e As Telerik.WebControls.Base.Calendar.Events.DayRenderEventArgs) Handles RadCalendar1.DayRender 
        If e.Day.[Date] = DateTime.Today OrElse e.Day.[Date] = DateTime.Today.AddDays(1) Then 
            Dim cellID As String = String.Format("{0}_{1}", RadCalendar1.ClientID, e.Day.[Date].ToString("yyyy_M_d")) 
            ' you need to assign an identifier for every cell that you would like to "tooltipify" 
            e.Cell.Attributes.Add("id", cellID) 
            RadToolTipManager1.TargetControls.Add(cellID, True
        End If 
    End Sub 

    Then you need to handle the AjaxUpdate server-side event of the tooltip manager and display the proper tooltip content based on the event date you are hovering over:

    C#
    protected void RadToolTipManager1_AjaxUpdate(object sender, ToolTipUpdateEventArgs e) 
        // get the event date from the cell id 
        string[] idParts = e.TargetControlID.Split(new char[] { '_' }); 
        int year = Int32.Parse(idParts[idParts.Length - 3]); 
        int month = Int32.Parse(idParts[idParts.Length - 2]); 
        int day = Int32.Parse(idParts[idParts.Length - 1]); 
        DateTime eventDate = new DateTime(year, month, day); 
     
        // display the proper content based on the event date 
        Label tooltipContentLabel = new Label(); 
        tooltipContentLabel.Text = string.Format("This is the event for {0}.<br />Current time is: {1}", eventDate.ToShortDateString(), DateTime.Now.ToLongTimeString()); 
     
        e.UpdatePanel.ContentTemplateContainer.Controls.Add(tooltipContentLabel); 

    VB.NET
    Protected Sub RadToolTipManager1_AjaxUpdate(ByVal sender As ObjectByVal 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 - 3)) 
        Dim month As Integer = Int32.Parse(idParts(idParts.Length - 2)) 
        Dim day As Integer = Int32.Parse(idParts(idParts.Length - 1)) 
        Dim eventDate As New DateTime(year, month, day) 
     
        ' display the proper content based on the event date 
        Dim tooltipContentLabel As New Label() 
        tooltipContentLabel.Text = String.Format("This is the event for {0}.<br />Current time is: {1}", eventDate.ToShortDateString(), DateTime.Now.ToLongTimeString()) 
     
        e.UpdatePanel.ContentTemplateContainer.Controls.Add(tooltipContentLabel) 
    End Sub 



  2. 73FCD5D1-3429-4ADB-A7B6-2621A8579331
    73FCD5D1-3429-4ADB-A7B6-2621A8579331 avatar
    39 posts
    Member since:
    Dec 2006

    Posted 14 Jun 2007 Link to this post

    One would expect  that if you click "Today" in the drop down menu, then today's date will be selected. This is not the case, it gets only the current month.  If I selected a date in the current month and did not unselect it, say June 1, 2007, then use the drop down menu to go to March 2010, then use the dropdown menu again to select "Today", the result is June 1 selected.

    -- Arie
  3. 3BD6F94B-4C03-46D3-8568-9982F1F201BF
    3BD6F94B-4C03-46D3-8568-9982F1F201BF avatar
    10940 posts
    Member since:
    May 2014

    Posted 15 Jun 2007 Link to this post

    Hi Arie Segev,

    We kindly ask you to restrain from questions that are not directly related with the project here and open a separate forum thread or ticket with your inquiries.
    Anyway here are the answers:
    • you can set the <FastNavigationSettings EnableTodayButtonSelection="True" /> property to true in order for the Today button to act as select button.
    • Why do you think that changing of months should unselect days? We do not believe that this behavior is intuitive at all and kindly ask you to point us to a control that offers such functionality.
    Thank you for the understanding on the matter.

    Kind regards,
    Steve
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  4. 73FCD5D1-3429-4ADB-A7B6-2621A8579331
    73FCD5D1-3429-4ADB-A7B6-2621A8579331 avatar
    39 posts
    Member since:
    Dec 2006

    Posted 15 Jun 2007 Link to this post

    Steve,
    My comments are specifically about  this code library project, so I don't understand your claim that it's not related. Regarding your bullet points. 
    1. Yes., I am aware of this.  
    2.  I am not arguing that at all, this is indeed the correct behavior to keep the selected dates if I moce to another month, BUT if I then click 'Today'  when I am in a different month, I would expect today to be marked.

    In any event, it was just FYI type of comments, because I believe the consistency of examples is important, so it does not digress the use from the central issues ( I know this is not central to the project itself but  as a   user when I encounter unexpcted behavior I wonder if it is because of the Prometheus implementaion or because of the Rad Calendar's functionality) .
    -- Arie
    p.s.  while not for this thread it just occurred to me that the semnatics of a day's click is actually an interesting issues. It may be worthwhile to have easy way to handle to separate logic  of selection and anchring, so when I click 'Today' the cell in the month view will be highlighted differently than anchored dates.  But this is for the RadCalendar guys.
  5. 3BD6F94B-4C03-46D3-8568-9982F1F201BF
    3BD6F94B-4C03-46D3-8568-9982F1F201BF avatar
    10940 posts
    Member since:
    May 2014

    Posted 18 Jun 2007 Link to this post

    Hi Arie Segev,

    What I was trying to say is that this code library serves a purpose to show a specific behavior and the comments you have provided are for the calendar in general (it will behave this way in any page where you have simply dragged & dropped calendar) and not for this code library specifically.
    On your second point - this is the default behavior which can work as you would expect it to if you enable the EnableTodayButtonSelection and set the EnableMultiSelect property to false. Either way the calendar will navigate to the current month irrelevant of the MultiSelect option, where Today will be selected.
    As for the semantic of the day click you mention, we have thought about this before, but there is no easy way of doing it and we have decided not to for now. If the interest in such functionality increases, we might consider it, but having in mind we are releasing a scheduler, we think it might not be necessary.

    Thank you for your involvement.

    Kind regards,
    Steve
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  6. 4BACFB1B-B8F9-4138-98AD-74173360C1BE
    4BACFB1B-B8F9-4138-98AD-74173360C1BE avatar
    68 posts
    Member since:
    Aug 2005

    Posted 10 Oct 2007 Link to this post

    Is there a reason the Prometheus version of RadCalendar wasn't used for this example?
  7. C7498A83-7E2E-418C-8791-93EF573A7569
    C7498A83-7E2E-418C-8791-93EF573A7569 avatar
    9934 posts
    Member since:
    Nov 2016

    Posted 11 Oct 2007 Link to this post

    Hello Michael,

    We did not include "Prometheus" version of RadCalendar in the demo is simply because by the time the demo was posted our calendar was not part of RadControls "Prometheus". For your convenience I have updated the web site to use RadCalendar "Prometheus" in conjunction with RadToolTip.

    Best regards,
    Stephen
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
Back to Top

This Code Library is part of the product documentation and subject to the respective product license agreement.