0
我試圖執行這個Telerik的網站提示:劍道提示加載內容與AJAX不顯示內容
http://demos.telerik.com/aspnet-mvc/tooltip/ajax
這是CSHTML網頁上我的腳本代碼:
@(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")
}
}
和控制器:
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();
}
而且結果是:
當我將鼠標懸停標籤,提示不顯示任何內容,當我調試,方法TooltipCustomer獲取參數「ID」,返回的StringBuilder準確,唐不知道我要去哪裏,請幫助我。
「ToolTipCustomer」局部視圖中有什麼? – chiapa 2014-11-05 10:36:59
Only @ Html.raw(ViewBag.Title) – 2014-11-06 01:29:35