ToolTip Not Refreshing After Initial Call

3 posts, 1 answers
  1. Rob
    Rob avatar
    115 posts
    Member since:
    Aug 2012

    Posted 29 Oct 2013 Link to this post

    I've created a simple page with a RadGrid and a RadToolTipManager on it.  What I'm trying to accomplish is very simple.  Each row in the grid has an ID and GridImageColumn.  When the image is clicked, the ID should display in the ToolTip window.  The issue I'm experiencing is after the first ToolTip is displayed, all subsequent attempts to display ToolTips always display the first ToolTip that was displayed, not the ToolTip for the row clicked.  So if 3 is clicked, I'd expect to see 3 in the ToolTip.  If 2 is clicked, I'd expect to see 2 in the Tooltip and so on. 

    Here is a video recording displaying the behavior of the issue.  If I refresh the page, I can start all over again.


    <%@ Page Language="VB" AutoEventWireup="false" CodeFile="rttm.aspx.vb" Inherits="rttm" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
    <head runat="server">
     <form id="form1" runat="server">
     <telerik:RadScriptManager runat="server" ID="mgrJS" AsyncPostBackTimeout="600">
     <telerik:RadGrid runat="server" ID="rg" AutoGenerateColumns="False" Width="620px" Skin="Web20">
     <MasterTableView HierarchyLoadMode="ServerOnDemand" Width="620px" TableLayout="Auto" DataKeyNames="ID">
     <telerik:GridBoundColumn HeaderText="ID" UniqueName="ID" DataField="ID">
    <telerik:GridImageColumn UniqueName="View" ImageUrl="App_Themes/BlueBT2009/Images/Inq.gif"></telerik:GridImageColumn>
     <FilterMenu EnableImageSprites="False">
     <telerik:RadToolTipManager ID="RadToolTipManager1" OffsetY="-1" HideEvent="Default"
     Width="800px" Height="600px" runat="server" EnableShadow="true" RelativeTo="BrowserWindow"
     Position="Center" OnAjaxUpdate="Load_ToolTip" 
    Modal="false" ContentScrolling="Auto" AutoCloseDelay="0" ShowEvent="OnClick" >


    Partial Class rttm
     Inherits System.Web.UI.Page
     Protected Sub rg_ItemDataBound(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridItemEventArgs) Handles rg.ItemDataBound
    If e.Item.ItemType = GridItemType.Item OrElse e.Item.ItemType = GridItemType.AlternatingItem Then
     Me.RadToolTipManager1.TargetControls.Add(TryCast(e.Item, GridDataItem)("View").ClientID, TryCast(e.Item, GridDataItem)("ID").Text, True)
    End If
     End Sub
     Protected Sub rg_NeedDataSource(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridNeedDataSourceEventArgs) Handles rg.NeedDataSource
    Dim dt As New DataTable()
    Dim col As New DataColumn("ID")
    Dim row As DataRow = dt.NewRow
    row(0) = 1
    row = dt.NewRow
    row(0) = 2
    row = dt.NewRow
    row(0) = 3
    Me.rg.DataSource = dt
    Session("rttm") = dt
    End Sub
     Protected Sub Load_ToolTip(ByVal sender As Object, ByVal args As ToolTipUpdateEventArgs)
    Dim invoiceDetails() As String = args.Value.Split("_")
    Dim toAdd As UserControl = LoadUserControl("rttmdetails.ascx", invoiceDetails)
    End Sub
     Private Function LoadUserControl(ByVal UserControlPath As String, ByVal ParamArray constructorParameters As Object()) As UserControl
    Dim constParamTypes As New List(Of Type)()
    For Each constParam As Object In constructorParameters
     Dim ctl As UserControl = TryCast(Page.LoadControl(UserControlPath), UserControl)
    Dim constructor As System.Reflection.ConstructorInfo = ctl.[GetType]().BaseType.GetConstructor(constParamTypes.ToArray())
    If constructor Is Nothing Then
     Throw New MemberAccessException("The requested constructor was not found on : " & ctl.[GetType]().BaseType.ToString())
    constructor.Invoke(ctl, constructorParameters)
    End If
     Return ctl
    End Function
    End Class


    <%@ Control Language="VB" AutoEventWireup="false" CodeFile="rttmDetails.ascx.vb" Inherits="rttmDetails" %>
    <telerik:RadGrid ID="rg" runat="server" AutoGenerateColumns="false" Skin="Web20" AllowMultiRowSelection="true">
    <MasterTableView Name="details" DataKeyNames="ID">
     <telerik:GridBoundColumn HeaderText="ID" UniqueName="ID" DataField="ID">


    Partial Class rttmDetails
     Inherits System.Web.UI.UserControl
     Private _id As String
     Public Property Identity() As String
     Return (_id)
    End Get
     Set(ByVal value As String)
    _id = value
    End Set
     End Property
     Private _details As DataRow()
    ReadOnly Property Details() As DataRow()
     Return _details
    End Get
     End Property
     Public Sub New()
    End Sub
     Public Sub New(ByVal id As String)
    Dim dt As DataTable = CType(Session("rttm"), DataTable)
    _id = id
    _details = dt.Select("ID=" & id)
    End Sub
     Protected Sub rgInvoice_NeedDataSource(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridNeedDataSourceEventArgs) Handles rg.NeedDataSource
    Me.rg.DataSource = Details
    End Sub
    End Class

    I'm sure this is a common issue that should have an easy fix.  I'm anxiously awaiting your answer.


  2. Answer
    Marin Bratanov
    Marin Bratanov avatar
    3555 posts

    Posted 29 Oct 2013 Link to this post

    Hi Rob,

    This article can explain the problem: The Controls loaded via AJAX retain old values section is what you need. Said shortly, you need to use the OnPreRender event of the user control to bind new data to the grid, otherwise it will be taken from the ViewState, i.e. from the first shown tooltip.

    Marin Bratanov
    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 the blog feed now.
  3. DevCraft R3 2016 release webinar banner
  4. Rob
    Rob avatar
    115 posts
    Member since:
    Aug 2012

    Posted 30 Oct 2013 Link to this post

    Your recommendation works for me!  Thank you!
Back to Top