Search code examples
c#asp.net-mvckendo-uikendo-tooltip

Kendo tooltip loading content with AJAX not showing content


I tried to implement a tooltip on this Telerik site :

http://demos.telerik.com/aspnet-mvc/tooltip/ajax

This is my script code on cshtml page:

@(Html.Kendo().Tooltip()
.For("#grOrders")
.Filter("td a")
.LoadContentFrom("ToolTipCustomer", "Home")
.Position(TooltipPosition.Right)
.Width(200)
.Height(150)
.Events(events => events.RequestStart("requestStart"))

)

Event requestStart:

function requestStart(e) {
    e.options.data = {
        id: e.target.data("id")
    }
}

And controller:

public ActionResult ToolTipCustomer(int id)
    {
        Customers objCustomer = new Customers();
        DaCustomers db = new DaCustomers();
        objCustomer = db.GetCustomerById(id);
        StringBuilder str=new StringBuilder();
        str.Append("<div style='text-align:left;'>");
        str.Append("<p>" + objCustomer.Name + "</p>");
        str.Append("</hr>");
        str.Append("<p>Address: " + objCustomer.Address + "</p>");
        str.Append("<p>Telephone: " + objCustomer.Phone + "</p>");
        str.Append("<p>Email: " + objCustomer.Email + "</p>");
        str.Append("</div>");
        ViewBag.Title=str;
        return PartialView();
    }

And result is:

when i hover tag a, tooltip not showing any content, when i debug, method TooltipCustomer get parameter "id" and return StringBuilder exactly, don't know where i am going wrong, please help me.


Solution

  • Problem solved. Sorry all, i make a common mistake.

    Default color of text on tooltip is white, and i set Background of tooltip the same.