Hello,
We are facing an issue in Telerik RadToolTipManager . We have a Radgrid with hyperlinks on each cell. Hover on hyperlink shows a tooltip which is a placeholder that contains few links and a radcombobox. RadGrid Columns are build with ItemTemplate
When we hover over the link on the first row , the tool tip appears with correct data. When we go the second row or to another cell, the tool tip still holds the old values. The occurrence of this issue is not consistent and is random. Some times the tooltip data is shown correct for first few mouse hovers across rows or across cells on the same row. Some times , it breaks in the second tooltip. There is no pattern in which this issue occurs.
We did a lot of ressearch on Telerik forums and tried the following
1. Clearing TargetControls. We also validated that each target control in Radtooltipmanager has a unique ID.
2. Adding the tooltip controls to args.UpdatePanel in PreRender Event
3. Making the surrounding div of the tooltip placeholder runat=server and then assign an ID
We are adding the target controls in the following way:
ToolTipTargetControl control = new ToolTipTargetControl()
control.IsClientID = true
control.TargetControlID = visitLink1.ClientID;
control.Value = Convert.ToString(visit.ID)
if (this.RadToolTipManager1 != null)
{
RadToolTipManager1.TargetControls.Add(control
}
We are adding the controls to tooltip as follows:
protected override void OnPreRender(EventArgs e)
{
base.OnPreRender(e)
if (this.ToolTipVisit != null)
{
this.ToolTipVisit = CreateToolTip()
ToolTipUpdatePanel.ContentTemplateContainer.Controls.Add(this.ToolTipVisit)
}
}
Can you please provide us help in solving this issue. Thank you in advance.
6 Answers, 1 is accepted
Hi,
Content to the tooltip should be added in the AjaxUpdate event, which fires after Page_Init and before Page_Load. The matter is usually with the controls inside - if they have ViewState, their values and data should be changed on PreRender of the user control you load in the tooltip:
- documentation: http://docs.telerik.com/devtools/aspnet-ajax/controls/tooltip/troubleshooting/common-issues#controls-loaded-via-ajax-retain-old-values.
- a demo with the same scenario: http://demos.telerik.com/aspnet-ajax/tooltip/examples/targetcontrolsandajax/defaultcs.aspx?product=tooltip.
Another thing you can try is to disable ViewState for the user control you load in the tooltip manager and/or for the tooltip manager itself.
Depending on the exact scenario you have, you may want to consider showing/editing the data in a page in RadWindow: http://demos.telerik.com/aspnet-ajax/controls/examples/integration/gridandwindow/defaultcs.aspx?product=window.
Regards,
Telerik
Hi Marin,
Thank you for your reply and suggestions
Sorry I did not mention in initial post that the controls inside the tooltip are generated dynamically. We are not using usercontrol. A placeholder is created runtime with the controls and radcombobox to be displayed inside the tooltip and added to the updatepanel. We are doing this in OnAjaxUpdate event as below in the Aspx page which has the RadToolTipManager and RadGrid controls
protected void OnAjaxUpdate(object sender, ToolTipUpdateEventArgs args)
{
this.UpdateToolTip(args.Value, args.UpdatePanel)
}
private void UpdateToolTip(string elementID, UpdatePanel panel)
{
//Get the test object for elementID
PlaceHolder toolTip = CreateToolTipPlaceHolder(test) as PlaceHolder
toolTip.ID = "ToolTip_" + elementID
this.ToolTipVisit = toolTip
this.ToolTipUpdatePanel = panel
}
protected override void OnPreRender(EventArgs e)
{
base.OnPreRender(e)
if (this.ToolTipVisit != null)
{
this.ToolTipUpdatePanel.ContentTemplateContainer.Controls.Add(this.ToolTipVisit)
}
}
If we add the controls to panel.ContentTemplateContainer in OnAjaxUpdate() - we are getting the old data getting displayed every time.
After moving the addition of controls to panel.ContentTemplateContainer to PreRender event - the issue does not occur every time but is occuring randomly
Also another issue we are facing in radcombobox related to this is - the selected index of radcombobox does not refresh and holds the value of the first row selected. This happens all the time in the tooltip. Dropdown selected item holds the first value or previous value selected in the grid
Can you please let us know your suggestions on this.
Thanks so much for your help.
Thank you for your reply and suggestions
Sorry I did not mention in initial post that the controls inside the tooltip are generated dynamically. We are not using usercontrol. A placeholder is created runtime with the controls and radcombobox to be displayed inside the tooltip and added to the updatepanel.
I tried with disabling the viewstate of the placeholder that wraps the controls inside tooltip with/without enabling viewstate of RadToolTipManager and did not get this to solve the issue.
We are populating data and creating controls in OnAjaxUpdate event as below in the Aspx page which has the RadToolTipManager and RadGrid controls
protected void OnAjaxUpdate(object sender, ToolTipUpdateEventArgs args)
{
this.UpdateToolTip(args.Value, args.UpdatePanel)
}
private void UpdateToolTip(string elementID, UpdatePanel panel)
{
//Get the test object for elementID
PlaceHolder toolTip = CreateToolTipPlaceHolder(test) as PlaceHolder
toolTip.ID = ToolTip_ + elementID
this.ToolTipVisit = toolTip
this.ToolTipUpdatePanel = panel
}
protected override void OnPreRender(EventArgs e)
{
base.OnPreRender(e)
if (this.ToolTipVisit != null)
{
this.ToolTipUpdatePanel.ContentTemplateContainer.Controls.Add(this.ToolTipVisit)
}
}
If we add the controls to panel.ContentTemplateContainer in OnAjaxUpdate() - we are getting the old data getting displayed every time.
After moving the addition of controls to panel.ContentTemplateContainer to PreRender event - the issue does not occur every time but is occuring randomly
Also another issue we are facing in radcombobox related to this is - the selected index of radcombobox does not refresh and holds the value of the first row selected. This happens all the time in the tooltip. Dropdown selected item holds the first value or previous value selected in the grid
Can you please let us know your suggestions on this.
Thanks so much for your help.
Hi Marin,
I tried with disabling the viewstate of the placeholder that wraps the controls inside the tooltip. This seems to have fixed the data issue on the label controls in tooltip but not on the radcombobox inside the tooltip. The datasource of the radcombobox is refreshed with the new list each time for the tooltips but the SelectedIndex does not change. Selected Index of the dropdown in the current row still shows the previous value that was set to the dropdown's selected index on the previous row.
ddlSitters.SelectedIndex = index (ddlSitters is a RadComboBox created dynamically and added to tooltip)
Please let us know your suggestions . Thank you
Hi Marin,
I tried with disabling the viewstate of the placeholder that wraps the controls inside the tooltip. This seems to have fixed the data issue on the label controls in tooltip but not on the radcombobox inside the tooltip. The datasource of the radcombobox is refreshed with the new list each time for the tooltips but the SelectedIndex does not change. Selected Index of the dropdown in the current row still shows the previous value that was set to the dropdown's selected index on the previous row.
ddlSitters.SelectedIndex = index
ddlSitters is a RadComboBox created dynamically and added to tooltip
Please let us know your suggestions . Thank you
Hello,
Try clearing the data source of the combo box before rebinding it. For example (in the user control loaded in the tooltip):
protected
override
void
OnPreRender(EventArgs e)
{
base
.OnPreRender(e);
ddlSitters.DataSource =
null
;
ddlSitters.DataBind();
//set new data source
ddlSitters.DataSource = GetData();
ddlSitters.DataBind();
this
.DataBind();
}
If this does not help either, I advise you open a formal support ticket and send us a small example that we can investigate.
Regards,
Telerik