I am following LoadonDemand example given in Online demo for RADToolTip. but am facing same problem. when the page loads for first time Tooltip is working smoothley but when the page postback happens am not able to get tooltip.
I am using latest hot fix for this RADControl. i.e 6/26/2007 release.
Here am sending sample code, please have a look on this sample.
This is my Default.aspx page
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Untitled Page</title>
<link rel="stylesheet" href="Skins/CustomSkin/ToolTip.CustomSkin.css" type="text/css" />
</head>
<body>
<form id="form1" runat="server">
<div>
<br />
<br />
<br />
<br />
<radG:RadGrid ID="RGSample" AllowPaging="true" PageSize="15" EnableAJAX="false" AutoGenerateColumns="false"
runat="server" Height="50%" DataSourceID="AccessDataSource1" OnItemDataBound="RGSample_ItemDataBound"
Skin="Grey" SkinsPath="RadControls/Grid/Skins" CssClass="RadGrid" CellPadding="2"
CellSpacing="2" OnDataBinding="RGSample_DataBinding" OnSortCommand="RGSample_SortCommand" OnDataBound="RGSample_DataBound1" >
<PagerStyle Mode="NumericPages" />
<MasterTableView AllowCustomPaging="False" AllowPaging="True" AllowSorting="True"
GridLines="both" HorizontalAlign="NotSet" PageSize="10" CellPadding="2" CellSpacing="2"
Width="100%" BorderColor="black">
<Columns>
<radG:GridHyperLinkColumn DataTextField="CustomerID" HeaderText="CustomerID" SortExpression="CustomerID"
UniqueName="CustomerID">
</radG:GridHyperLinkColumn>
<radG:GridTemplateColumn HeaderText="ContactName" SortExpression="ContactName" UniqueName="ContactName">
<ItemTemplate>
<asp:Label ID="lblContactName" runat="server" Text='<%#Eval("ContactName") %>'></asp:Label>
</ItemTemplate>
</radG:GridTemplateColumn>
<radG:GridBoundColumn DataField="CompanyName" HeaderText="CompanyName" SortExpression="CompanyName"
UniqueName="CompanyName">
</radG:GridBoundColumn>
<radG:GridTemplateColumn UniqueName="Click">
<ItemTemplate>
<asp:ImageButton ID="imgBtn" runat="server" ImageUrl="~/24find.gif" CommandName="Find" />
</ItemTemplate>
</radG:GridTemplateColumn>
</Columns>
</MasterTableView>
<ClientSettings>
<Scrolling AllowScroll="true" SaveScrollPosition="true" UseStaticHeaders="true" />
</ClientSettings>
</radG:RadGrid>
<asp:AccessDataSource ID="AccessDataSource1" runat="server" DataFile="~/App_Data/Nwind.mdb"
SelectCommand="SELECT top 10 [CustomerID], [CompanyName], [ContactName] FROM [Customers]">
</asp:AccessDataSource>
</div>
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<telerik:RadToolTipManager ID="RTMCustomer" runat="server" RelativeTo="Mouse" Position="MiddleRight"
BorderStyle="None" Width="250px" Height="300px" Animation="None" Sticky="true"
ManualClose="true" Skin="CustomSkin" EnableEmbeddedSkins="false" OnAjaxUpdate="RTMCustomer_OnAjaxUpdate"
ShowCallout="true" EnableViewState="false">
</telerik:RadToolTipManager>
</form>
</body>
</html>
Here is my .CS file
using System;
using System.Data;
using System.Configuration;
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 _Default : System.Web.UI.Page
{
protected Dictionary<string, string> controlcollection = new Dictionary<string, string>();
protected void Page_Load(object sender, EventArgs e)
{
}
protected void RGSample_ItemDataBound(object sender, Telerik.WebControls.GridItemEventArgs e)
{
if (e.Item.ItemType == Telerik.WebControls.GridItemType.Item || e.Item.ItemType == Telerik.WebControls.GridItemType.AlternatingItem)
{
System.Web.UI.WebControls.Label lblContactName = (System.Web.UI.WebControls.Label)e.Item.FindControl("lblContactName");
if (lblContactName != null)
{
DataRowView currentRow = (DataRowView)e.Item.DataItem;
if (!controlcollection.ContainsKey(lblContactName.ClientID))
controlcollection.Add(lblContactName.ClientID, currentRow.Row["CustomerID"].ToString());
}
//if (!Page.IsPostBack)
//{
// lblContactName.ID = currentRow.Row["CustomerID"].ToString();
//}
if (this.RTMCustomer != null)
this.RTMCustomer.TargetControls.Add(lblContactName.ClientID, true);
}
}
protected void RTMCustomer_OnAjaxUpdate(object sender, Telerik.Web.UI.ToolTipUpdateEventArgs e)
{
Dictionary<string, string> controls = (Dictionary <string, string>)Session["controlcollection"];
int index = e.TargetControlID.LastIndexOf("_");
//string elementID = e.TargetControlID.Substring(index + 1);
string elementID = controls[e.TargetControlID];
this.UpdateToolTip(elementID, e.UpdatePanel);
}
private void UpdateToolTip(string elementID, UpdatePanel panel)
{
try
{
Control ctrlPopup = Page.LoadControl("Popup.ascx");
panel.ContentTemplateContainer.Controls.Add(ctrlPopup);
PopUp popUp = (PopUp)ctrlPopup;
popUp.CustomerID = elementID;
}
catch (Exception)
{
}
}
protected void RGSample_DataBinding(object sender, EventArgs e)
{
RTMCustomer.TargetControls.Clear();
}
protected void RGSample_SortCommand(object source, Telerik.WebControls.GridSortCommandEventArgs e)
{
RTMCustomer.TargetControls.Clear();
}
protected void RGSample_DataBound1(object sender, EventArgs e)
{
Session.Add("controlcollection", controlcollection);
}
}
Looking forward for your support
Thanks
PRASANNA