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

ListView + ToolTipManager incorrect display after row inserted on partial postback

4 Answers 87 Views
ToolTip
This is a migrated thread and some comments may be shown as answers.
Humayun Lari
Top achievements
Rank 1
Humayun Lari asked on 04 Jun 2008, 03:41 PM
I am using the ToolTipManager to provide on-demand content (via OnAjaxUpdate) for a ListView. The ListView and ToolTipManager are inside an UpdatePanel.

Everything works fine initially.

However, when a new row is added to the ListView, the on-demand content now shows content for the "old" rows. For example, row 1 now shows content for row 2 (the old row 1).

It appears that the ToolTipManager's TargetControls values are not being updated on the client after the partial postback. How can this be fixed? Thanks!

4 Answers, 1 is accepted

Sort by
0
Tsvetie
Telerik team
answered on 09 Jun 2008, 08:57 AM
Hello Humayun Lari,
In case you update the RadToolTipManager, when you update the ListView, you should not have such a problem. In case you could prepare and send us a simple running project, demonstrating the problem, we will research on our side what is causing it.

Sincerely yours,
Tsvetie
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Rod
Top achievements
Rank 1
answered on 21 Jul 2008, 07:59 PM
Hi, I am having the same issue (or very similar) to this one...

In my case, when the initial databind event is fired the values for the targetcontrol is set, but on later databind this values stays (happens only on Internet Explorer 7, with Mozilla 2.x or Mozilla 3.0 works fine).

For instance, if the initial databind has the following datasource {"Item 1.0", "Item 2.0", "Item 3.0"}, further updates to the repeater datasource such as {"Item 1.1", "Item 2.1", "Item 3.1"} the contains the old value when the onajax event is fired.

Here is my code sample.

RadToolTipManagerAndRepeater.aspx code
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="RadToolTipManagerAndRepeater.aspx.cs" 
    Inherits="TestPages_RadToolTipManagerAndRepeater" %> 
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %> 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
 
<html xmlns="http://www.w3.org/1999/xhtml">  
<head runat="server">  
    <title>Untitled Page</title> 
</head> 
<body> 
    <form id="form1" runat="server">  
        <asp:ScriptManager ID="ScriptManager" runat="server" /> 
        <div> 
            <telerik:RadAjaxPanel ID="UpdatePanel" runat="server" > 
            <asp:Panel ID="ToUpdate" runat="server">  
                <asp:TextBox ID="ItemName" runat="server" Text="Anything" /> 
                <asp:Button ID="UpdateNow" runat="server" Text="Update Now!" OnClick="UpdateNow_Click" /> 
                <asp:Repeater ID="Repeater1" runat="server" OnItemDataBound="Repeater1_ItemDataBound">  
                    <HeaderTemplate> 
                        <ul> 
                    </HeaderTemplate> 
                    <ItemTemplate> 
                        <li> 
                            <asp:HyperLink ID="Link" runat="server" NavigateUrl="javascript:void(0);"><%# Container.DataItem %></asp:HyperLink> 
                        </li> 
                    </ItemTemplate> 
                    <FooterTemplate> 
                        </ul> 
                    </FooterTemplate> 
                </asp:Repeater> 
                <telerik:RadToolTipManager ID="RadToolTipManager1" runat="server" ManualClose="true" 
                    Skin="Vista" Modal="true" ShowEvent="OnClick" OnAjaxUpdate="RadToolTipManager1_AjaxUpdate">  
                    <TargetControls> 
                        <telerik:ToolTipTargetControl TargetControlID="Repeater1" Value="" /> 
                    </TargetControls> 
                </telerik:RadToolTipManager> 
            </asp:Panel> 
            </telerik:RadAjaxPanel> 
        </div> 
    </form> 
</body> 
</html> 

And the code behind
using System;  
using System.Data;  
using System.Configuration;  
using System.Collections;  
using System.Web;  
using System.Web.Security;  
using System.Web.UI;  
using System.Web.UI.WebControls;  
using System.Web.UI.WebControls.WebParts;  
using System.Web.UI.HtmlControls;  
using System.Collections.Generic;  
 
public partial class TestPages_RadToolTipManagerAndRepeater : System.Web.UI.Page  
{  
    List<string> list = new List<string>();  
 
    protected void Page_Load(object sender, EventArgs e)  
    {  
        if (!this.IsPostBack)  
            UpdateNow_Click(sender, e);  
    }  
 
    protected void ListDataBind()  
    {  
        Repeater1.DataSource = list;  
        Repeater1.DataBind();  
    }  
 
    protected void UpdateNow_Click(object sender, EventArgs e)  
    {  
        for (int i = 0; i < 10; i++)  
        {  
            list.Add(string.Format("{0}_{1}", ItemName.Text, i.ToString()));  
        }  
        ListDataBind();  
    }  
 
    protected void Repeater1_ItemDataBound(object sender, RepeaterItemEventArgs e)  
    {  
        if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)  
        {  
            string s = e.Item.DataItem as string;  
            HyperLink h = e.Item.FindControl("Link"as HyperLink;  
 
            RadToolTipManager1.TargetControls.Add(h.ClientID, s, true);   
        }  
    }  
 
    protected void RadToolTipManager1_AjaxUpdate(object sender, Telerik.Web.UI.ToolTipUpdateEventArgs e)  
    {  
        e.UpdatePanel.ContentTemplateContainer.Controls.Add(new LiteralControl("<br />" + e.Value));  
    }  
}  
 
0
Svetlina Anati
Telerik team
answered on 22 Jul 2008, 01:15 PM
Hi Rod,

I assume that the problem comes from the fact that you did not update the RadToolTipManager's TargetControls collection when you update the target controls and that is why it holds the old values.

I suggest to call the following code:

//clear old values  
 
RadToolTipManager1.TargetControls.Clear(); 

in the UpdateNow_Click handler.

If this does not help, please open a new support ticket and attach a fully working reproduction project, including a sample database, there. Once I receive it, I will ,odify it in order to function as you desire.


Kind regards,
Svetlina
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Rod
Top achievements
Rank 1
answered on 22 Jul 2008, 05:38 PM
Thanks Svetlina, that do the trick.
Tags
ToolTip
Asked by
Humayun Lari
Top achievements
Rank 1
Answers by
Tsvetie
Telerik team
Rod
Top achievements
Rank 1
Svetlina Anati
Telerik team
Share this question
or