This is a migrated thread and some comments may be shown as answers.

Tooltip show when set cursor in TextBox.

2 Answers 177 Views
ToolTip
This is a migrated thread and some comments may be shown as answers.
Grzesiek
Top achievements
Rank 2
Iron
Grzesiek asked on 16 Feb 2008, 05:27 PM
Hey!

I have question. When I already set tooltip on TextBox it is showing when the mouse over at it. But when I click on a textbox to write, the Tooltip disappear.

Basically I want to show ToolTip when I click the TextBox - and disappear when I click another TextBox.

How to do this?

2 Answers, 1 is accepted

Sort by
0
Accepted
Fernandes
Top achievements
Rank 1
answered on 16 Feb 2008, 10:43 PM
Hi Grzesiek,

I think you can try the following workaround to achieve your goals.

I really don't know if there's an easier (or better) way to do what you want, but since it's so specific (you just want to close the previous tooltip when you click on the next textbox), I think you have to do something like this.

Let me know how it goes.

Fernandes

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %> 
 
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %> 
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml">  
<head runat="server">  
    <title>Tooltip Demo</title>     
</head> 
<body> 
<script language="javascript" type="text/javascript">  
    function textbox2OnClick()  
    {  
        var textBox1Tooltip= $find("<%= RadToolTip1.ClientID %>");  
        textBox1Tooltip.hide();  
          
        var textBox2Tooltip= $find("<%= RadToolTip2.ClientID %>");  
        textBox2Tooltip.show();  
 
    }  
    </script> 
    <form id="form1" runat="server">  
        <asp:ScriptManager ID="ScriptManager1" runat="server" /> 
        <telerik:RadToolTip ID="RadToolTip1" runat="server" TargetControlID="TextBox1" RelativeTo="Element" 
         Text="Textbox1 Tooltip" ShowEvent="OnFocus" Sticky="true">  
            </telerik:RadToolTip> 
            <telerik:RadToolTip ID="RadToolTip2" runat="server" TargetControlID="TextBox2"  RelativeTo="Element" 
         Text="Textbox2 Tooltip" Sticky="true" ShowEvent="FromCode">  
            </telerik:RadToolTip> 
        <div> 
            <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox> 
            <asp:TextBox ID="TextBox2" runat="server" onfocus="textbox2OnClick()"></asp:TextBox>              
        </div> 
    </form> 
</body> 
</html> 
 
0
Grzesiek
Top achievements
Rank 2
Iron
answered on 17 Feb 2008, 11:07 AM
Hey!

Thank you for help me, but I found answer in your code here:
ShowEvent="FromCode"

The answer is
ShowEvent="OnFocus"

And all is working fine :-)
Tags
ToolTip
Asked by
Grzesiek
Top achievements
Rank 2
Iron
Answers by
Fernandes
Top achievements
Rank 1
Grzesiek
Top achievements
Rank 2
Iron
Share this question
or