Tooltip not appearing with correct text

3 posts, 0 answers
  1. James
    James avatar
    20 posts
    Member since:
    Jan 2012

    Posted 29 Jan 2013 Link to this post

    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. Maria Ilieva
    Admin
    Maria Ilieva avatar
    4017 posts

    Posted 01 Feb 2013 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. James
    James avatar
    20 posts
    Member since:
    Jan 2012

    Posted 05 Feb 2013 Link to this post

    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;
        }
    }
     
Back to Top