C # setting tooltip for <asp: Label> or <asp: Literal>

What is the best way to add TOOLTIP to a shortcut or literal from code behind an ASP.NET C # site?

+5
source share
2 answers

Use the WebControl.ToolTip property to set the tooltip for the label management tool.

Label1.ToolTip = "Your text as tooltip";
+12
source

I recommend not using WebControls, but I recommend using HtmlControls as they provide a more direct view of the generated HTML output.

, asp:Literal WebControl, , WebControls, , ToolTip.

ToolTip HTML title="", . Literal, , title="tip text goes here".

HtmlControls, Attributes, :

HtmlControl div = new HtmlGenericControl("div");
div.Attributes["title"] = "tooltip text here";
+11

All Articles