1

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:

     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

Nate Pet
  • 44,246
  • 124
  • 269
  • 414
  • 1
    `ToolTip` is the tooltip of the client's OS. So you cannot change that from server. You could use a custom div instead with appropriate CSS. – Tim Schmelter Oct 30 '12 at 16:00
  • Dup - http://stackoverflow.com/questions/3178377/setting-particular-part-of-the-tool-tip-text-to-be-bold-with-different-font-colo – Micah Armantrout Oct 30 '12 at 16:01
  • You should use javascript instead. Just because it is a client side response. – BrOSs Oct 30 '12 at 16:01

1 Answers1

4

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.

If you wish to format your tooltip you should use a javascript tooltip alternative.

Here is a link to a popular tooltip jQuery plugin which I have had good experience with:

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:

header["Emp"].Attributes["data-tooltip"] = "Employee<b>Number</b>"; 
Community
  • 1
  • 1
Curtis
  • 101,612
  • 66
  • 270
  • 352