Set tooltip using html text
need to set table cell tool tip from text like below. table created dynamically.
<div>Red - if > 1.5 % gr开发者_JS百科oss margin erosion</div> <div>Yellow - if >.5% - 1.49 % variance</div>
I need to remove html tags and show tool tip as below
Red - if > 1.5 % gross margin erosion
Yellow - if >.5% - 1.49 % variance
can you help me pls.
what i currently doing is
tooltiptext= System.Web.HttpUtility.HtmlDecode(tooltiptext);
and replcace DIV tags from string
after asign it to table cell tooltip value.
this is working but is there any way to format html text and replcace tags on it other than above?
You can do this by setting the table cell to runat="server" and then in code behind you can add the tooltip.
Also you can easily assign the condition in code behind.
<table>
<tr>
<td id="td1" run="server">sample text</td>
</tr>
</table>
And in code behind use this inside the condition
((HtmlTableCell)this.FindControl("td1")).Attributes.Add("Title", "test");
精彩评论