This is a migrated thread and some comments may be shown as answers.

Tooltip not appearing with correct text

2 Answers 47 Views
Calendar
This is a migrated thread and some comments may be shown as answers.
James
Top achievements
Rank 1
James asked on 29 Jan 2013, 12:33 PM
Hi there I have a radcalendar which has highlighted dates from a dictionary which contains a list of datetimes. The dates are expiry dates for courses and in the dictionary I have the names matched against the right dates. Only the last course name of the list of courses expiring for a date is being displayed so if i have "Word Course", and "Excel Course" and they both expire 31/12/13 the tooltip is coming out as "Excel Course" only instead of "Word Course, Excel Course". I'm unsure how to get this working any help would be greatly appreciated. Here is my current code:

  public void RadCalendar_DayRender(object sender, Telerik.Web.UI.Calendar.DayRenderEventArgs e)
    {


        DBSecurity security = SecurityBAL.TryCastSecurity(Session);
        int index = 0;
        foreach (KeyValuePair<string, DateTime?> pair in expiringCourses)
        {
            RadCalendarDay calendarDay = new RadCalendarDay();
            string name = pair.Key;
            DateTime? date = pair.Value;
            calendarDay.ItemStyle.BorderColor = Color.Blue;
            calendarDay.Date = date.Value;
            if (!calendarDay.ToolTip.Contains(name))
            {
                calendarDay.ToolTip += name;
                calendarEvents.SpecialDays.Add(calendarDay);
            }

        }
}

2 Answers, 1 is accepted

Sort by
0
Maria Ilieva
Telerik team
answered on 01 Feb 2013, 01:06 PM
Hi James,

In order to further investigate on the presented issue I would kindly ask you to share your RadGrid markup as well as the related code behind. Thus we will be able to inspect your scenario and do our best to provide a proper solution.

Kind regards,
Maria Ilieva
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
James
Top achievements
Rank 1
answered on 05 Feb 2013, 10:12 AM
One of your support ticket staff kindly sent me this code which works perfectly. Posting it here in case someone else with a similar problem comes along:

Dictionary<string, DateTime> originalExpiringCourses = new Dictionary<string, DateTime>();
 
originalExpiringCourses.Add("excel", DateTime.Parse("31/01/2013"));
originalExpiringCourses.Add("word", DateTime.Parse("31/01/2013"));
originalExpiringCourses.Add("access", DateTime.Parse("31/01/2013"));
originalExpiringCourses.Add("powerpoint", DateTime.Parse("10/02/2013"));
originalExpiringCourses.Add("photoshop", DateTime.Parse("10/02/2013"));
 
var SortedExpiringCourses = from item in originalExpiringCourses
                            orderby item.Value ascending
                            select item;
 
List<KeyValuePair<string, DateTime>> groupedExpiringCourses = new List<KeyValuePair<string, DateTime>>();
 
foreach (var expiringCourse in SortedExpiringCourses)
{
    if (groupedExpiringCourses.Count == 0 || expiringCourse.Value != groupedExpiringCourses[groupedExpiringCourses.Count - 1].Value)
    {
        groupedExpiringCourses.Add(new KeyValuePair<string, DateTime>(expiringCourse.Key, expiringCourse.Value));
    }
    else
    {
        KeyValuePair<string, DateTime> newPair = new KeyValuePair<string, DateTime>(groupedExpiringCourses[groupedExpiringCourses.Count - 1].Key + "," + expiringCourse.Key, expiringCourse.Value);
        groupedExpiringCourses[groupedExpiringCourses.Count - 1] = newPair;
    }
}
 
Tags
Calendar
Asked by
James
Top achievements
Rank 1
Answers by
Maria Ilieva
Telerik team
James
Top achievements
Rank 1
Share this question
or