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

ToolTip Not Updating

2 Answers 83 Views
ListView
This is a migrated thread and some comments may be shown as answers.
TAD RHODES
Top achievements
Rank 1
TAD RHODES asked on 19 May 2010, 08:49 PM
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 Answers, 1 is accepted

Sort by
0
Nikita Gourme
Top achievements
Rank 1
answered on 20 May 2010, 01:33 PM
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
0
TAD RHODES
Top achievements
Rank 1
answered on 20 May 2010, 02:30 PM
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
Tags
ListView
Asked by
TAD RHODES
Top achievements
Rank 1
Answers by
Nikita Gourme
Top achievements
Rank 1
TAD RHODES
Top achievements
Rank 1
Share this question
or