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

How do I use RadToolTipManager like RadToolTip for content?

1 Answer 291 Views
ToolTip
This is a migrated thread and some comments may be shown as answers.
bemara57
Top achievements
Rank 1
bemara57 asked on 22 Apr 2008, 06:57 PM
I have a RadToolTip with special content defined for a target control. It turns out I'm going to have to use the same the RadToolTip for several target controls. I know I would have to use the RadToolTipManager for this, but how do I put my content in there like I did with the RadToolTip? Here's what my current ToolTip looks like:

<telerik:RadToolTip ID="RadToolTip1" runat="server"  
    TargetControlID="pageActionsLink" 
    Position="BottomLeft" 
    OffsetX="-20" 
    OffsetY="-2" 
    ManualClose="false" 
    Sticky="true"   
    RelativeTo="Element" 
    Animation="Resize" 
    Skin="WebBlue">    
        <asp:LinkButton ID="pageEditLink" runat="server"  
            Text="Edit" 
            CommandName="Edit" 
            CommandArgument="mainpage" 
            OnCommand="PageTools_Click" 
            CssClass="pageToolsEdit"  
            CausesValidation="false" /> 
        <br /> 
        <asp:LinkButton ID="pageCreateLink" runat="server"  
            Text="Create" 
            CommandName="Create" 
            CommandArgument="mainpage" 
            OnCommand="PageTools_Click" 
            CssClass="pageToolsCreate"  
            CausesValidation="false" /> 
        <br /> 
        <asp:LinkButton ID="pageCopyLink" runat="server" 
            Text="Copy" 
            CommandName="Copy" 
            CommandArgument="mainpage" 
            OnCommand="PageTools_Click" 
            CssClass="pageToolsCopy"  
            CausesValidation="false" /> 
        <br /> 
        <asp:LinkButton ID="pageRenameLink" runat="server"  
            Text="Rename"  
            CommandName="Rename" 
            CommandArgument="mainpage" 
            OnCommand="PageTools_Click" 
            CssClass="pageToolsRename" 
            CausesValidation="false" /> 
</telerik:RadToolTip> 

I tried doing this but it gave a compile error saying it doesn't recognize my content:
<telerik:RadToolTipManager ID="RadToolTipManager1" runat="server" 
    Position="BottomLeft" 
    OffsetX="-20" 
    OffsetY="-2" 
    ManualClose="false" 
    Sticky="true"   
    RelativeTo="Element" 
    Animation="Resize" 
    Skin="WebBlue"
    <TargetControls> 
        <telerik:ToolTipTargetControl TargetControlID="control1" /> 
        <telerik:ToolTipTargetControl TargetControlID="control2" /> 
        <telerik:ToolTipTargetControl TargetControlID="control3" />         
    </TargetControls> 
    <asp:LinkButton ID="LinkButton1" runat="server"  
        Text="Edit" 
        CommandName="Edit" 
        CommandArgument="mainpage" 
        OnCommand="PageTools_Click" 
        CssClass="pageToolsEdit"  
        CausesValidation="false" /> 
    <br /> 
    <asp:LinkButton ID="LinkButton2" runat="server"  
        Text="Create" 
        CommandName="Create" 
        CommandArgument="mainpage" 
        OnCommand="PageTools_Click" 
        CssClass="pageToolsCreate"  
        CausesValidation="false" /> 
    <br /> 
    <asp:LinkButton ID="LinkButton3" runat="server" 
        Text="Copy" 
        CommandName="Copy" 
        CommandArgument="mainpage" 
        OnCommand="PageTools_Click" 
        CssClass="pageToolsCopy"  
        CausesValidation="false" /> 
    <br /> 
    <asp:LinkButton ID="LinkButton4" runat="server"  
        Text="Rename"  
        CommandName="Rename" 
        CommandArgument="mainpage" 
        OnCommand="PageTools_Click" 
        CssClass="pageToolsRename" 
        CausesValidation="false" /> 
</telerik:RadToolTipManager> 

Can I add content to the RadToolTipManager like the RadToolTip?

1 Answer, 1 is accepted

Sort by
0
Accepted
Tsvetie
Telerik team
answered on 25 Apr 2008, 07:51 AM
Hi bemara57,
You cannot put the content you wish to show in the RadToolTips the manager creates between the opening and closing tags of the RadToolTipManager as usually, different target elements, have different titles. You can create a UserControl with that content, and use the AjaxUpdate event of the manager to load the control inside the tooltip that is about to open. However, in this case, I believe it would be easier, to use a single RadToolTip for all target elements, and set its TargetControlId dynamically.

For example:
<body>  
    <form id="form1" runat="server">  
        <asp:ScriptManager ID="ScriptManager1" runat="server" />  
          
        <asp:Label ID="Label1" runat="server" Text="Target 1" onmouseover="ShowToolTip(this);"></asp:Label>  
        <asp:Label ID="Label2" runat="server" Text="Target 2" onmouseover="ShowToolTip(this);"></asp:Label>  
        <asp:Label ID="Label3" runat="server" Text="Target 3" onmouseover="ShowToolTip(this);"></asp:Label>  
        <asp:Label ID="Label4" runat="server" Text="Target 4" onmouseover="ShowToolTip(this);"></asp:Label>  
        <asp:Label ID="Label5" runat="server" Text="Target 5" onmouseover="ShowToolTip(this);"></asp:Label>          
          
        <telerik:RadToolTip ID="RadToolTip1" runat="server" RelativeTo="Element" IsClientID="true">  
            Content  
        </telerik:RadToolTip>  
    </form>   
    <script type="text/javascript">  
    function ShowToolTip(element)  
    {  
        var tooltip = $find('<%= RadToolTip1.ClientID %>');  
          
        setTimeout(function(){  
            tooltip.set_targetControlID(element.id);  
            tooltip.show();  
        }, 100);  
    }  
    </script>     
</body> 


All the best,
Tsvetie
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
ToolTip
Asked by
bemara57
Top achievements
Rank 1
Answers by
Tsvetie
Telerik team
Share this question
or