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

Dynamic Tool Tip problem when tool tip is inside repeater.

2 Answers 245 Views
ToolTip
This is a migrated thread and some comments may be shown as answers.
Akki
Top achievements
Rank 1
Akki asked on 21 Dec 2011, 10:53 AM
Hi,
I have problem with dynamic tool tip. It is inside a repeater and the tool tip is assigned to <asp:linkbutton>. tooltip targetControld is assigned to linkbutton but dynamically linkbutton id is changing because same linkbutton is used three times in same repeater. Based on the linkbutton id i need to change caption of tool tip text. Can u please suggest.

<asp:Repeater ID="WidgetList" runat="server" EnableViewState="true"
                                                    onitemcommand="WidgetList_ItemCommand">                                
                                                    <ItemTemplate>                            
                                                        <table width="100%">
                                                            <tr>
                                                                <td height="50" background="../images/Arrowlarge.bmp" style="background-repeat: no-repeat">
                                                                    <table height="50px">
                                                                        <tr>
                                                                            <td height="50">
                                                                                <img src="../images/Folder.gif" alt="" style="height: 30px" width="30px" />
                                                                            </td>
                                                                            <td height="50">
                                                                                <asp:LinkButton ID="lnkText_towarehouse" OnClick="lnkText_towarehouse_Click" ValidationGroup='<%# Eval("TypeId") %>'
                                                                                    Text='<%# Eval("TextData") %>' runat="server" Font-Bold="true" Font-Size="Small" ></asp:LinkButton>
                                                                                <telerik:RadToolTip runat="server" ID="RadToolTip1" RelativeTo="Element" Width="390px" Text="Test"
                                                                                    Height="70px" IsClientID="true" EnableViewState="true" TargetControlID="lnkText_towarehouse"
                                                                                    Position="TopRight">                         
                                                                                </telerik:RadToolTip>
                                                                            </td>
                                                                        </tr>
                                                                    </table>
                                                                </td>
                                                            </tr>
                                                        </table>
                                                    </ItemTemplate>
                                                </asp:Repeater>

Regards,
Akki

2 Answers, 1 is accepted

Sort by
0
Accepted
Marin Bratanov
Telerik team
answered on 21 Dec 2011, 03:54 PM
Hello Akki,

Do not set the IsClientID to true in this case. The Repeater is an INaming container and thus it changes the IDs of the elements inside it, so when you provide only the server ID the tooltips cannot properly attach to the links that have new ids now. This approach is shown in this online demo - the right hand side Gridview.

Then, you can access the new ID via JavaScript and set it as text for the tooltip, or perform your other calculations as dictated by your logic:

<asp:Repeater ID="WidgetList" runat="server" EnableViewState="true" OnItemCommand="WidgetList_ItemCommand">
    <ItemTemplate>
        <table width="100%">
            <tr>
                <td height="50" background="../images/Arrowlarge.bmp" style="background-repeat: no-repeat">
                    <table height="50px">
                        <tr>
                            <td height="50">
                                <img src="../images/Folder.gif" alt="" style="height: 30px" width="30px" />
                            </td>
                            <td height="50">
                                <asp:LinkButton ID="lnkText_towarehouse" OnClick="lnkText_towarehouse_Click" ValidationGroup='<%# Eval("TypeId") %>'
                                    Text='<%# Eval("TextData") %>' runat="server" Font-Bold="true" Font-Size="Small"></asp:LinkButton>
                                <telerik:RadToolTip runat="server" ID="RadToolTip1" RelativeTo="Element" Width="390px" RenderInPageRoot="true"
                                    Text="Test" Height="70px" IsClientID="false" EnableViewState="true" TargetControlID="lnkText_towarehouse"
                                    Position="TopRight" OnClientShow="OnClientShow">
                                </telerik:RadToolTip>
                            </td>
                        </tr>
                    </table>
                </td>
            </tr>
        </table>
    </ItemTemplate>
</asp:Repeater>
<script type="text/javascript">
    function OnClientShow(sender, args)
    {
        var targetControl = sender.get_targetControl();
        sender.set_text(targetControl.id);
    }
</script>


All the best,
Marin
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
0
Akki
Top achievements
Rank 1
answered on 22 Dec 2011, 06:15 AM
Hi marin,
Thanks for your support.

Regards,
Akki
Tags
ToolTip
Asked by
Akki
Top achievements
Rank 1
Answers by
Marin Bratanov
Telerik team
Akki
Top achievements
Rank 1
Share this question
or