Tooltip show when set cursor in TextBox.

3 posts, 1 answers
  1. Grzesiek
    Grzesiek avatar
    105 posts
    Member since:
    Jun 2007

    Posted 16 Feb 2008 Link to this post

    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. Answer
    Fernandes
    Fernandes avatar
    33 posts
    Member since:
    Mar 2005

    Posted 16 Feb 2008 Link to this post

    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> 
     
  3. Grzesiek
    Grzesiek avatar
    105 posts
    Member since:
    Jun 2007

    Posted 17 Feb 2008 Link to this post

    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 :-)
Back to Top