Search code examples
kendo-uikendo-asp.net-mvckendo-tooltip

Kendo tooltip empty with LoadContentFrom


When using LoadContentFrom in my Kendo.Tooltip, the tooltip is always empty, all I see is a grey box the size I specified. It does go to the controller to get the data (verified with breakpoint), but after that, nothing. If I use ContentTemplateId instead, it shows the template, but I really need to get some dynamic data from the server. What am I missing to fix this?

Thanks

<%:Html.Kendo().Tooltip()
    .For("#alertPanel")
    .LoadContentFrom("AlertsDetails", "Home")
    .Width(320).Height(320)
%>

Controller:

public ActionResult AlertsDetails()
{
    List<object> list = new List<object>();
    //fill list with data ...
    ViewBag.title = "New alerts";
    return PartialView(list);
}

Solution

  • Answer: You can't return data the way I was doing. You need to format the data server-side in an HTML string and set the result in the ViewBag.

        public ActionResult AlertsDetails()
        {
            ViewBag.Title = "<a href='#'>A link</a>";
            return PartialView();
        }
    

    and

    <%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<dynamic>" %>
    
    <%= ViewBag.Title%>
    

    That's it...