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

How to close RadtooltipManger using server side code

4 Answers 271 Views
ToolTip
This is a migrated thread and some comments may be shown as answers.
Ram
Top achievements
Rank 1
Ram asked on 04 Dec 2009, 06:00 PM
Hi,

I am opening a user control (which has a close button in it) in radtooltipmanager.
 I want to execute some server side code on close button and at the same time i want to close the radtooltipmanager, how can I achieve this ?

Is there any way to Close the radtooltipmanager from code behind (on close button click)


Regards,

4 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 07 Dec 2009, 11:25 AM
Hi Ram,

In order to close the RadToolTip, all you need to do is execute a javascript function that calls the hide method of the RadToolTip client object. Here is the forum link which discusses how to close the tooltip from code behind.
closing tooltip server-side

-Shinu.
0
Svetlina Anati
Telerik team
answered on 07 Dec 2009, 02:58 PM
Hello Ram,

 Indeed, the suggestion Shinu provided will work. However, fo convenience we have implemented a static method which will save you some code. Please, modify the client script which you execute from teh server in the following manner:

function CloseActiveToolTip()   
        {    
            setTimeout(function(){    
                var tooltip = Telerik.Web.UI.RadToolTip.getCurrent();   
                if (tooltip) tooltip.hide();   
            }, 1000);  


Note, also that you can reduce the timeout, depending on your particular page (most often a timeout of 0ms will do the trick).

Sincerely yours,
Svetlina
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
aster
Top achievements
Rank 1
answered on 15 Sep 2010, 08:55 PM
Could you please elaborate a bit more on the usage.

I am trying to accomplish the exact same behavior but am having trouble getting the code to work.

I have a user control that gets called via the RadToolTip Manager. This user control has a grid, on selecting any of the items in the grid the tooltip should close and populate a textbox on the parent page.

Following is the code that I have written in the select index changed of the grid in the user control
Private Sub grdn_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles grd.SelectedIndexChanged
 
 Page.ClientScript.RegisterStartupScript(Page.GetType(), "closeActiveTip", " CloseActiveToolTip(sendValue);", True)
 
End Sub

I have the following JavaScript on the Parent ASPX page

function CloseActiveToolTip(valuefromToolTip) {
           //do something with value from tool tip
 
           setTimeout(function() {
               var tooltip = Telerik.Web.UI.RadToolTip.getCurrent();
               if (tooltip) tooltip.hide();
           }, 10);
       }

The Javascript never gets executed. Could you please let me know if I am missing out something.

Thanks!
0
Svetlina Anati
Telerik team
answered on 20 Sep 2010, 03:23 PM
Hi aster,

 Your code seems to be correct for the basic setup. The only thing I can think of that might cause the problem is that you are using AJAX for the grid.

Would you please test the following:

1) If you are using a RadAjaxManager, add the script to the ajax manager's ResponseScripts collection instead of executing it through the ClientScriptManager of the Page

2) Try whether using ScriptManager.RegisterClientScript resolves the problem.

Sincerely yours,
Svetlina
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
ToolTip
Asked by
Ram
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Svetlina Anati
Telerik team
aster
Top achievements
Rank 1
Share this question
or