Dynamic Tool Tip problem when tool tip is inside repeater.

3 posts, 1 answers
  1. Akki
    Akki avatar
    79 posts
    Member since:
    Nov 2011

    Posted 21 Dec 2011 Link to this post

    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. Answer
    Marin Bratanov
    Admin
    Marin Bratanov avatar
    3595 posts

    Posted 21 Dec 2011 Link to this post

    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
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Akki
    Akki avatar
    79 posts
    Member since:
    Nov 2011

    Posted 22 Dec 2011 Link to this post

    Hi marin,
    Thanks for your support.

    Regards,
    Akki
Back to Top