Tri Nguyen Dung wrote:
Anyone know a good alternative to the tooltip? I need a function to show a tool tip on hyperlink, is DotNetNuke module support a tooltip which can contain html text?
I am using C# to add a dynamic hyperlink which will show an html contain tooltip.
Example: Hyperlink1.ToolTip = "html contain" ;
If DotNetNuke has a specific control which can show tool tip, please let me know. I just want to show a cool tool tip which is supported from DotNetNuke Module.
Finally, my issue is how to make Tooltip for HTML content in DotNetNuke Module?
This is the ultimate answer for the question above.
Using C#, I create a dynamic help label from DotNetNuke module:
//Create an instance of Dnn Label
DotNetNuke.UI.UserControls.LabelControl myDnnLabel;
myDnnLabel = (DotNetNuke.UI.UserControls.LabelControl)LoadControl("~/controls/LabelControl.ascx");
//Set an html tooltip for the helptext attribute
myDnnLabel.HelpText = @toolTip;
//Create a css style whatever you want, eg: text-align: left; color: blue; etc....
myDnnLabel.CssClass = "dnnLabelStyle";
Now I will clear the help icon on Dnn Label:
//When I set a text for Dnn Label, I will add an html hyperlink tag to cover the text of Dnn Label, so that the help icon will disappear from Dnn Label and it just look like a normal text
myDnnLabel.Text = "<a href='#'>This is a normal text with Dnn Tooltip</a>";
Do two steps above we will have a text with Dnn Tooltip. Is that cool, isn't it!
If you want to add an url on the text with Dnn Tooltip, and see it just a normal hyperlin with a tool tip. Then just do the next step as follow:
//I add an attribute called onclick and it will open the url when user click on the text with Dnn Tooltip.
myDnnLabel.Text = "<a href='#' onclick=\"window.open('" + url + "', '_self');\">This is a normal text with Dnn Tooltip</a>";
Conclusion: Ok, that is all the way to use Dnn Tooltip which contain html value on a normal text or hyperlink or some other control.
I hope my work can help other people around here who stuck on the same issue as mine.