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

radtooltip doesn't update my user control

7 Answers 222 Views
ToolTip
This is a migrated thread and some comments may be shown as answers.
calm_boy
Top achievements
Rank 1
calm_boy asked on 20 Jun 2008, 12:04 PM
Hi.

I am using a radtooltip with a repeater on my master page. When i hover over the items of my repeater, the tooltip displays, but it only shows the values of the 1st item i hovered.
The funny thing is that it worked at first but then stopped working.

I have tried then to put it in an update panel, but it doesn't show anything anymore. it comes up but empty.

HELP!!!!!!!

7 Answers, 1 is accepted

Sort by
0
Svetlina Anati
Telerik team
answered on 23 Jun 2008, 12:42 PM
Hi calm_boy,

Since I do not have your code I am not quite sure what causes the described problem.

I assume that the problem comes from the fact that you set  the values for the controls in your User Control in the Page_Load handler. In this case, you will have to do it at a later stage in the page lifecycle - for example, in the OnPreRender handler. Let's assume that you set the new values in a method called ShowCurrentDetails - then you should not use this code

protected void Page_Load(object sender, EventArgs e)  
{   
    this.ShowCurrentDetails();  
}   
 

but this one:

protected override void OnPreRender(EventArgs e)  
{  
    base.OnPreRender(e);  
    this.ShowCurrentDetails();  

In case this does not fix the problem, please open a new support ticket and send me a sample, fully runnable reproduction project and I will do my best to help.


All the best,
Svetlina
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Jason Priddy
Top achievements
Rank 1
answered on 07 Oct 2009, 04:16 PM
Hello Calm_Boy,

I had the same exact problem as you and what you could try is what I was able to get working.
If you simply set the element that is the TargetControl to runat="server" and include your RadToolTip control inside the repeater, that should give you the result you want.
 
See Below:

<u id="title" runat="server"><%# Eval("Title") %></u>

 

 

<telerik:RadToolTip runat="server" ID="RadToolTip2" Width="200px" Position="MiddleRight" ManualClose="true" RelativeTo="Element" TargetControlID="title">

 

<%

# Eval("Intro") %>

 

 

</telerik:RadToolTip>


Thanks and let me know if that works for you!

Jason
0
Matthew
Top achievements
Rank 1
answered on 14 Oct 2010, 10:21 PM
For what its worth, I just had the same issue.  I was able to resolve it in my situation by clearing the TargetControls collection on a postback.  The problem seems to be that the RadToolTip remembers its TargetControls across postbacks, so in my case I was paging over a repeater which would load 10 items at a time.  I noticed the TargetControls count was accumulating rather than starting from 0 on each postback.  So, I added this:

protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            if (Page.IsPostBack)
            {
                toolTipMgr.TargetControls.Clear();
            }
        }

This is the Load method for a control which contains the RadToolTip control (toolTipMgr).  I'm guessing the inner workings of the ToolTip control just tries to match up in accordance with the index of the target control vs. an actual link by something like an ID (total guess).

Putting the RadToolTip control inside the repeater may work, but one RadToolTip control can have multiple TargetControls, which makes adding multiple RadToolTips quite silly in my opinion.
0
Jason Priddy
Top achievements
Rank 1
answered on 18 Dec 2010, 07:09 PM

Hi Matthew,

Thanks for the follow up message and I totally agree with you.  Your solution is much cleaner.  I'm going to modify the page to use your handy utility method you pasted here to clear out the tooltip manger target controls on each postback. Great find!

Thanks again,

Jason

0
Svetlina Anati
Telerik team
answered on 20 Dec 2010, 03:10 PM
Hi guys,

 
Indeed, not cleared target controls collection can cause the same problem but the core in both situations which seem to cause the same result is not the same and thus I would like to shed some light on the matter.

Case1) The TargetControls collection has not be cleared and it is repopulated - if the newly added targets have the same IDs as the old ones, the old ones are first found and their value is used to show the information. This case happens usually when paging or sorting is used - more details are available below:

http://demos.telerik.com/aspnet-ajax/tooltip/examples/targetcontrolsandajax/defaultcs.aspx

To resolve this problem you should clear and repopulate the collection.

Case2) The TargetControls collection has the correct targets and values but the new values for controls with ViewState are set too early in the page lifecycle. Let me explain in brief why we chose to fire the OnAjaxUpdate so early in the life cycle because this is done on purpose. When we add to the tooltip controls with ViewState we have to make sure that these controls are created before the LoadViewState event fires so that their ViewState information is loaded. In order to avoid forcing our clients to recreate all their controls in the Init event on postback, we decided to fire the AjaxUpdate event earlier in the page lifecycle. We believe that setting a value in PreRender is the easiest part of code to leave for the developer and it is also not needed in all scenarios - e.g in some of our online demos, while recreation of dynamically created and added controls will be needed in any LOD scenario. Note, also, that the main purpose of the control is to be used for presentation purposes, despite it could be used as a dialog but the purpose of a dialog is the base of RadWindow and every control should work according to its main purpose out of the box and if it could be fine-tuned for other purposes this might need some code. This being said, there will be different result if you are using a Label and a TextBox, the difference in their behavior is in the ViewState and it is caused by the main difference between the two controls which is that the Label can't be edited and the TextBox could be edited and the value should be passed to the server by using the ViewState. For such cases you should set the new values in the PreRender event.

I hope that my reply is detailed enough and helpful, let me klnow if you have additional questions.

Best wishes,

Svetlina
the Telerik team

 

Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0
Robot B9
Top achievements
Rank 2
answered on 05 Apr 2012, 02:52 PM
I also am only getting the first item in the data repeater to show the tooltip.
I am not using LOD, and have the data I need to populate the tooltip, and have tried a few of the things above. I do not necessarily need and don't want to move this to a LOD scenario to get it to work. Would I be able to get this to work as configured below? I have the following code in a radPageView

<asp:Repeater ID="Repeater1" runat="server">
    <ItemTemplate>
        <div class="generic-container" style="position: relative; margin: 0px 10px 0px 10px;
            overflow: auto">
            <div class="title">
                <table>
                    <tr>
                        <td>
                            <asp:Image ID="Image1" runat="server" ImageUrl='<%# ProjectClientLogo(eval("Client")) %>'
                                Style="float: right; margin: -4px 0px 0px 0px;" />
                        </td>
                        <td>
                            <asp:Label ID="Label1" Text='<%#Bind("Client") %>' runat="server" Style="float: left;
                                margin: -3px 0px 0px 10px;" />
                        </td>
                    </tr>
                </table>
            </div>
            <asp:DataList ID="dlProj" DataKeyField="Project" RepeatDirection="Horizontal" ShowFooter="False"
                ShowHeader="False" runat="server" RepeatLayout="Table">
                <ItemTemplate>
                    <div class="pad" id="divProj">
                        <div class="titlesmall">
                            <div class='<%# cstr(Eval("AccessableClass")) %>'>
                                <%#CStr(Eval("ShortName"))%>
                            </div>
                        </div>
                        <div>
                            <a href='<%# GetProjectURL(eval("ProjectURL"),eval("IsAccessable")) %>' class='<%#                         Eval("IsAccessableImageCssClass") %>'>
                                <asp:Image ID="imgProj" runat="server" class='<%# Eval("IsAccessableImageCssClass") %>'
                                    src='<%# GetProjectImageURL("small", cstr(Eval("Project"))) %>' />
                            </a>
                        </div>
                    </div>
                    <telerik:RadToolTip ID="rttProjInfo" runat="Server" TargetControlID="divProj" IsClientID="true"
                        RelativeTo="Element" HideEvent="LeaveTargetAndToolTip" Position="MiddleRight"
                        Title="Project Information">
                        <ul>
                            <li>Project:
                                <%#Eval("Project")%>
                            </li>
                            <li>Project Name:
                                <%#Eval("ProjectName")%>
                            </li>
                            <li>Location:
                                <%#Eval("Location")%>
                            </li>
                            <li>Nucleus Group Contact:
                                <%#Eval("PrimaryContact")%>
                            </li>
                            <li>URL:
                                <%#Eval("LinkTitle")%>
                            </li>
                        </ul>
                    </telerik:RadToolTip>
                </ItemTemplate>
            </asp:DataList>
        </div>
    </ItemTemplate>
    <SeparatorTemplate>
        <br />
    </SeparatorTemplate>
</asp:Repeater>


0
Marin Bratanov
Telerik team
answered on 06 Apr 2012, 11:34 AM
Hello Mark,

You have set a client ID as a target for the tooltip. In a databound control, however, you will get many instances of the same template, so I suggest you add the runat="server" attribute to this div and set the IsClientID of the RadToolTip to false. A similar case is shown in the following online demo: http://demos.telerik.com/aspnet-ajax/tooltip/examples/tooltipversustooltipmanager/defaultcs.aspx. The right hand side grid is using separate tooltips in each row and each of them targets the server control with the provided ID.


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.
Tags
ToolTip
Asked by
calm_boy
Top achievements
Rank 1
Answers by
Svetlina Anati
Telerik team
Jason Priddy
Top achievements
Rank 1
Matthew
Top achievements
Rank 1
Robot B9
Top achievements
Rank 2
Marin Bratanov
Telerik team
Share this question
or