1

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

<div>Red - if &gt; 1.5 % gross 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?

1 Answer 1

3

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");
Sign up to request clarification or add additional context in comments.

1 Comment

I think this question revolves more around the HTML encoding / decoding, since he already has the string in HTML encoded format.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.