How to close RadtooltipManger using server side code

5 posts, 0 answers
  1. Ram
    Ram avatar
    49 posts
    Member since:
    Feb 2009

    Posted 04 Dec 2009 Link to this post


    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)

  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 07 Dec 2009 Link to this post

    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

  3. DevCraft R3 2016 release webinar banner
  4. Svetlina Anati
    Svetlina Anati avatar
    2795 posts

    Posted 07 Dec 2009 Link to this post

    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()   
                    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,
    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.
  5. aster
    aster avatar
    5 posts
    Member since:
    Dec 2009

    Posted 15 Sep 2010 Link to this post

    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.

  6. Svetlina Anati
    Svetlina Anati avatar
    2795 posts

    Posted 20 Sep 2010 Link to this post

    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,
    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
Back to Top
DevCraft R3 2016 release webinar banner