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

RadTooltip is not showing when the html code is generated in code behind

1 Answer 187 Views
ToolTip
This is a migrated thread and some comments may be shown as answers.
Kumaran
Top achievements
Rank 1
Iron
Kumaran asked on 28 Apr 2016, 09:35 AM

Hi,

I am using RadTooltip to show some additional info inside a RadGrid cell. The tooltip is showing fine when the page loads. I have a scenario where on some user action, the grid data will change. So I am doing this using a service. The service will load the grid (ascx) in code behind and send back the html code. The html code contains the tool tip with some differences in it. Not sure why it is behaving like this ? The telerik classes not getting applied.

On Load

<div style="position: absolute; z-index: 8000; visibility: hidden; left: 227px; top: 542px; display: none;" unselectable="on" class="RadToolTip RadToolTip_Default rtVisibleCallout rosterPopup rtShadow rtRoundedCorner" id="RadToolTipWrapper_ctl00_PlaceHolderMain_ctl00_ctl00_TelerikRosterGridView_ctl00_ctl05_RadToolTipLastName"><div class="rtRelativeWrapper"><span style="visibility: visible;" class="rtCallout rtCalloutTopLeft">&nbsp;</span><div class="rtContent"><div><div><p>Tooltip content</p></div></div></div></div></div>

 

Code behind

<div style="display:none;position:absolute;" id="ctl00_TelerikRosterGridView_ctl00_ctl07_RadToolTipLastName" class="rosterPopup"><div><p>Tooltip content</p></div><input id="ctl00_TelerikRosterGridView_ctl00_ctl07_RadToolTipLastName_ClientState" name="ctl00_TelerikRosterGridView_ctl00_ctl07_RadToolTipLastName_ClientState" type="hidden"></div>

 

Thanks

Kumaran

1 Answer, 1 is accepted

Sort by
0
Marin Bratanov
Telerik team
answered on 03 May 2016, 07:32 AM

Hi Kumaran,

I am not sure how and where those snippets are used, but here is some info on how RadToolTip works and how to use it, so you can apply this to your scenario:

  • the most common way to tie RadToolTip and RadGrid together is to add targets for the RadToolTipManager and setup its load on demand. Here is a demo that shows this scenario: http://demos.telerik.com/aspnet-ajax/tooltip/examples/targetcontrolsandajax/defaultcs.aspx?product=tooltip.
  • RadToolTipManager can automatically take the title attribute of an HTML node and create a RadToolTip from it, instead of the browser providing the tooltip. What's important here is that this works only on the initial page load or after the content was updated with AJAX (a partial postback). If you "manually" change the HTML via JavaScript, the tooltip manager cannot be notified of this change and the old target and content it had created will not be detached from the actual DOM, because the elements that were used have been disposed. In such cases you should use the tooltipify(parentNode) method the tooltip manager offers where you should pass a suitable parent node whose children were changed: http://docs.telerik.com/devtools/aspnet-ajax/controls/tooltip/client-side-programming/radtooltipmanager-object. That's basically what RadToolTIpManager does internally for AJAX requests.
  • RadToolTips are MS AJAX-based WebForms server controls. This means they require postbacks to be created and to work, as they rely on the WebForms page lifecycle on the server and the MS AJAX lifecycle on the client. Just putting their HTML on the page is not enough to initialize them and for them to work. Thus, they cannot be returned as plain HTML from a WebService, for example, as is the case with all IScriptControls such as ours. 

I hope this helps you understand how the control works and how you can employ it in your case.

Regards,

Marin Bratanov
Telerik
Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
Tags
ToolTip
Asked by
Kumaran
Top achievements
Rank 1
Iron
Answers by
Marin Bratanov
Telerik team
Share this question
or