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

FromCode + ManualClose not working

1 Answer 70 Views
ToolTip
This is a migrated thread and some comments may be shown as answers.
p
Top achievements
Rank 1
p asked on 10 Mar 2009, 11:36 PM

Seems like ManualClose is not working when I use "FromCode". Below is my code snippet. Any help will be greatly appreciated.

By the way, I posted here yesterday regarding the "clicked enter" issue. The issue is that my button is "being clicked" when the user hits enter, and therefore the tooltip is displayed. Basically, i'm trying to prevent the tooltip from showing up when user hits enter. I just want it to be displayed when user actually "clicks" on the button. Thats what the code below is doing. It accomplishes that except that the tooltip disappears by itself. I need it to be closed manually and not automatically. I also tried just setting a large value for the hidedelay property but that doesnt seem to work as well. please help.

<script type="text/javascript">  
          
        var enterPressed = false;  
 
        //displays the tooltip, prevents it from being displayed when user hits enter  
        function DisplayToolTip(tooltipClientID)  
        {  
                         
            var radToolTip1 = $find(tooltipClientID);             
     
                    
            if (enterPressed == false)  
            {  
                radToolTip1.show();  
            }  
            
              
        }  
          
        //detect whether the enter key is pressed.  
        function detectEnter(evn)  
        {  
                                                    
            if (window.event && window.event.keyCode == 13)  
            {  
                  enterPressed = true;  
            }  
            else if (evn && evn.keyCode == 13)  
            {  
                  enterPressed = true;  
                    
            }  
            else  
            {  
                  enterPressed = false;  
                  
            }        
              
        }  
          
          
        
        document.onkeypress = detectEnter;  
        document.onmousedown = detectEnter;  
</script> 
          
<asp:ImageButton ID="ImageButton1" CausesValidation="false" runat="server"/>  
 
<telerik:RadToolTip ID="RadToolTip1" runat="server" Skin="Default" Width="300"    
                    ShowEvent="FromCode" 
                    HideEvent="ManualClose" 
                    TargetControlID="ImageButton1" 
                    IsClientID="false"                                      
                    RelativeTo="Element"    
                    ShowCallout="False"   
                    Position="BottomRight"                                       
                    > 
</telerik:RadToolTip>



on the codebehind (.cs file), i have this:

ImageButton1.OnClientClick =

"DisplayToolTip('" + RadToolTip1.ClientID +"')";

 

 

1 Answer, 1 is accepted

Sort by
0
Tsvetie
Telerik team
answered on 13 Mar 2009, 03:41 PM
Hello,
The problem is not that the ManualClose functionality of the RadToolTip does not work, but rather that when you click the ImageButton, you postback the page. In order to prevent this, you can use the following:
ImageButton1.OnClientClick = "DisplayToolTip('" + RadToolTip1.ClientID + "');return false;"

All the best,
Tsvetie
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
ToolTip
Asked by
p
Top achievements
Rank 1
Answers by
Tsvetie
Telerik team
Share this question
or