ToolTip Not Updating

3 posts, 0 answers
  1. TAD RHODES
    TAD RHODES avatar
    31 posts
    Member since:
    Jul 2009

    Posted 19 May 2010 Link to this post

    Gotta be something simple I'm missing here.

    I have a list view of Products.  I also have a tooltip.
    <telerik:RadToolTipManager ID="RadToolTipManager1" OffsetY="-1" HideEvent="ManualClose" MouseTrailing="true"  
            Width="450" runat="server" Animation="Resize" Sticky="true" EnableEmbeddedSkins="true" ShowCallout="true" OnAjaxUpdate="OnAjaxUpdate" Height="400" ContentScrolling="Auto" RelativeTo="Element" Skin="Telerik" AutoCloseDelay="0" Position="MiddleRight"
        </telerik:RadToolTipManager> 

    In the code behind I attach the tooltip to the product Image in the listview.
    protected void rlvWishlist_ItemDataBound(object sender, RadListViewItemEventArgs e) 
            { 
     
                var target = e.Item.FindControl("rbiProduct"); 
                if (Equals(target, null)) return; 
     
                var item = (RadListViewDataItem) e.Item; 

                RadToolTipManager1.TargetControls.Add(target.ClientID, 
                                                      e.Item.OwnerListView.DataKeyValues[item.DisplayIndex]["ProductID"].ToString(), 
                                                      true); 
            } 

    I then use the OnAjaxUpdate to load a user control to display the contents of the tooltip.
    protected void OnAjaxUpdate(object sender, ToolTipUpdateEventArgs args) 
            { 
                UpdateToolTip(args.Value, args.UpdatePanel); 
            } 
     
            private void UpdateToolTip(string elementID, UpdatePanel panel) 
            { 
                 
     
                var ctrl = Page.LoadControl("~/UserControls/ucProductDetail.ascx"); 
                panel.ContentTemplateContainer.Controls.Add(ctrl); 
                var productDetail = (ucProductDetail) ctrl; 
                rlvWishlist.Rebind(); 
                productDetail.ProductID = Convert.ToInt32(elementID); 
            } 

    The problem is; it works great when I load the listview initially.  However, if I rebind the list view with another set of products the OnAjaxUpdate still sends in the previous bound listview productIDs. I can see in the rlvWishlist_ItemDataBound that the new ProductID is being set in the target control add method, but when I invoke the tooltip by hovering over the image the args.Value is still the original bound set of data (ProductIDs).

    I also tried clearing the tooltip target controls in the rlvWishlist_NeedDataSource, but that doesn't seem to work either.

    Any help would be appreciated.

    Thank you,
    Tad


  2. Nikita Gourme
    Nikita Gourme avatar
    318 posts
    Member since:
    May 2006

    Posted 20 May 2010 Link to this post

    My suggestion would be to clear the target controls of the tooltip manager before rebinding the listview control. For the grid I used this demo as sample for one of my projects and it worked properly.

    Nikita
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. TAD RHODES
    TAD RHODES avatar
    31 posts
    Member since:
    Jul 2009

    Posted 20 May 2010 Link to this post

    Nikita,

    Thanks for the prompting.  I had the listview rebinding when an item was selected in a combo box.  I had the target controls clearing inside the selected index change, however I forgot to set the ajax manager to ensure it updated the tool tip control.  I put that in there and it works correctly.

    Thanks again,
    Tad
Back to Top