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

Changing TargetControl on the client

0 Answers 156 Views
ToolTip
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Telerik Admin
Top achievements
Rank 1
Telerik Admin asked on 23 Nov 2011, 01:54 PM
A rather popular scenario when using the RadToolTip is to use a single instance on the page and utilize the onmouseover event of the  targeted elements to set a new target for the tooltip via JavaScript and show it. Generally the better approach would be to use a RadToolTip for each control or a RadToolTipManager to load content on demand, yet using a single instance reduces the markup on the page, so it is sometimes used.

When you change a RadToolTip's TargetControl (or TargetControlID) then call its show() method since Q3 2011 you need to do so with a small timeout, e.g.:

<input type="text" onmouseover="showToolTipNewTarget(this);" />


<script type="text/javascript">
    function showToolTipNewTarget(newTarget) 
    {
        var radTooltip1 = $find("RadToolTip1");
        radTooltip1.set_targetControl(newTarget);
        setTimeout(function () {
            radTooltip1.show();
        }, 20);
    }
</script>



If you do not use this timeout the necessary calculations cannot be performed and usually the tooltip will be shown next to the previous target.
Tags
ToolTip
Asked by
Telerik Admin
Top achievements
Rank 1
Share this question
or