Q:

ToolTip encoding issue

<asp:HyperLink ID="TestHyperLink" runat="server"></asp:HyperLink>

I am having the above hyperlink.  I am just setting the text with below code:
string textFromUser = "This is test's."; 
string encodedText=HttpUtility. HtmlEncode(textFromUser);
TestHyperLink. Text = encodedText;
TestHyperLink. ToolTip = encodedText;

The issue is that text of hyperlink is coming correct but tooltip is showing encoded characters. 

How can I make tooltip appear in the same way as text is? 

A:

You're seeing that problem because the attribute value is being encoded twice. 

The ' character is encoded into &#39;;
The & character is encoded into &amp;. 

Finally the output is sent to the browser as title="This is test&amp;quot;s.".  Since the attribute value is already being encoded by default, you can safely set the Tooltip property to the raw text and encode only the text for the Text property. 
Note: In this case the attribute encoding is performed by default, but HtmlEncode in .NET versions before 4.0 did not encode the ' character.  See HtmlEncode and UrlEncode Now Encode Single Quotation Marks. 
Update: I did some googling and found out this interesting reference (Which ASP.NET Controls Automatically Encodes?)  that may be outdated but at least for this specific case the documented behavior is the one you got.