简体   繁体   English

asp.net c#以粗体显示工具提示

[英]asp.net c# show tooltip in bold

I am trying to show a tooltip within my codebehind. 我试图在我的代码隐藏中显示工具提示。 (I am using ASP.NET C#) What I like to do is to show part of the tooltip in bold as such: I have the following: (我正在使用ASP.NET C#)我喜欢做的是以粗体显示部分工具提示:我有以下内容:

     header["Emp"].ToolTip = "Employee<b>Number</b>"; 

it doesn't seem to work as the what it shows is: 它似乎不像它显示的那样工作:

    Employee<b>Number</b>

Thank you in advance 先感谢您

You cannot display bold tooltips in the way in which you are trying to do. 您无法以您尝试的方式显示粗体工具提示。

Tooltip property renders as a title attribute on the HTML element, which doesn't support formatting . Tooltip属性在HTML元素上呈现为title属性, 不支持格式化

If you wish to format your tooltip you should use a javascript tooltip alternative. 如果您希望格式化工具提示,则应使用javascript工具提示替代方法。

Here is a link to a popular tooltip jQuery plugin which I have had good experience with: 这是一个流行的工具提示jQuery插件的链接,我有很好的经验:

http://bassistance.de/jquery-plugins/jquery-plugin-tooltip/ http://bassistance.de/jquery-plugins/jquery-plugin-tooltip/


So that your client-side can access this data, I would add it as a HTML5 data-* attribute, and read from that: 因此,您的客户端可以访问此数据,我会将其添加为HTML5 data-*属性,并从中读取:

header["Emp"].Attributes["data-tooltip"] = "Employee<b>Number</b>"; 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM