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

tooltip doubles information from database

2 Answers 51 Views
ToolTip
This is a migrated thread and some comments may be shown as answers.
Kevin
Top achievements
Rank 1
Kevin asked on 19 May 2014, 06:19 PM
Hi,

Ok probably doing something wrong but its stumping me.  tyring to get a radtooltipmanager working for instructions for a page.  So if they hover over an image it pops up with the instructions from a database.  The problem is that its is doubling up the information, its like 2 pulls are coming out of the database, so all the text is written and then written agian.

<div class="cancelpg">
           <h3><asp:Label ID="lblInstruct" runat="server">Hover over this <asp:Image ID="imgHover" runat="server" ImageUrl="~/Images/ViewResources.gif" /> for Instructions</asp:Label>
               <telerik:RadToolTipManager ID="rttmInstructions" runat="server" Position="Center" Modal="true" ManualClose="true" OnAjaxUpdate="rttmInstructions_AjaxUpdate">
                   <TargetControls>
                       <telerik:ToolTipTargetControl TargetControlID="imgHover" />
                   </TargetControls>
               </telerik:RadToolTipManager>
           </h3>
       </div>
 
 
Protected Sub rttmInstructions_AjaxUpdate(sender As Object, e As Telerik.Web.UI.ToolTipUpdateEventArgs) Handles rttmInstructions.AjaxUpdate
       Dim lblInsideToolTip As New Label()
       sql = "Select strMessage from iMAC_Message"
 
       myDataTable = New DataTable
       myDataTable = getReader(sql)
 
       If myDataTable.Rows.Count > 0 Then
           lblInsideToolTip.Text = myDataTable.Rows(0)(0)
       End If
 
       e.UpdatePanel.ContentTemplateContainer.Controls.Add(lblInsideToolTip)
   End Sub

2 Answers, 1 is accepted

Sort by
0
Accepted
Marin Bratanov
Telerik team
answered on 20 May 2014, 03:17 PM

Hello Kevin,

VB pages automatically connect event handlers through the Handles clause in the code-behind. Since the control markup has the event handler declared as well, it is simply added and called twice. You can easily confirm this by adding a breakpoint in the server code.

The same will happen with any server control, for example:

<asp:Button ID="Button1" Text="test" OnClick="Button1_Click" runat="server" />
Protected Sub Button1_Click(sender As Object, e As System.EventArgs) Handles Button1.Click
    Response.Write("I was called at: " + Now.Ticks.ToString() + "<br />")
End Sub

What you need to do to avoid this is to remove one of the declarations - either from the markup, or the Handles clause. Here is an example from the markup:

<telerik:RadToolTipManager ID="rttmInstructions" runat="server" Position="Center"
                           Modal="true" HideEvent="ManualClose">
    <TargetControls>
        <telerik:ToolTipTargetControl TargetControlID="imgHover" />
    </TargetControls>
</telerik:RadToolTipManager>
on a side note - the correct way to use the manual close button is through the HideEvent property.

Regards,

Marin Bratanov
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Kevin
Top achievements
Rank 1
answered on 20 May 2014, 04:38 PM
ok i see the problem, thanks for the help.
Tags
ToolTip
Asked by
Kevin
Top achievements
Rank 1
Answers by
Marin Bratanov
Telerik team
Kevin
Top achievements
Rank 1
Share this question
or