开发者

Set tooltip using html text

开发者 https://www.devze.com 2023-02-15 09:30 出处:网络
need to set table cell tool tip from text like below. table created dynamically. <div>Red - if &gt; 1.5 % gr开发者_JS百科oss margin erosion</div><div>Yellow - if &gt;.5% - 1

need to set table cell tool tip from text like below. table created dynamically.

<div>Red - if &gt; 1.5 % gr开发者_JS百科oss margin erosion</div>    <div>Yellow - if &gt;.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");
0

精彩评论

暂无评论...
验证码 换一张
取 消