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

ToolTip.set_targetControl broken in Q3.1314?

13 Answers 139 Views
ToolTip
This is a migrated thread and some comments may be shown as answers.
Quinten
Top achievements
Rank 1
Quinten asked on 25 Feb 2010, 09:37 PM
I have a tooltip solution that was working under Q3.1208 that breaks when I upgrade to Q3.1314.  I have a static tooltip in the HTML like this:

    <telerik:RadToolTip ID="rttConfigPanel" runat="server" Modal="true" ShowCallout="true" 
        ShowDelay="0" HideDelay="500" HideEvent="ManualClose" Title="Widget Configuration" 
        ShowEvent="FromCode" TargetControlID="tabLayoutTabs"
        <iframe id="iFrameConfigPanel" src=""></iframe> 
    </telerik:RadToolTip> 

I have a Javascript function on the same page that reveals the tooltip:

        function showToolTip(sender, args) { 
            // cause the tooltip to appear near the command icon that triggered it 
            var tooltip = $find("<%=rttConfigPanel.ClientID %>"); 
            tooltip.set_targetControl(args.Command.get_element()); 
            tooltip.show(); 
 
            // send a fresh querystring to the config panel so it doesn't load from cache 
            var sURL = "WidgetConfigPanel.aspx"
            var oDate = new Date(); 
            var iframe = document.getElementById("iFrameConfigPanel"); 
            sURL = sURL + "?id=" + args.Command.get_name(); 
            sURL = sURL + "&RandomNumber=" + oDate.getHours() + "-" + oDate.getMinutes() + "-" + oDate.getMilliseconds(); 
            iframe.src = sURL; 
        } 

The function gets when the user clicks a (custom) RadDock command button.  It's set up like this:

Dim cmd As New DockCommand() 
cmd.CssClass = WidgetCommandIconCssClasses.CommandConfig 
cmd.Name = WidgetCommands.ConfigPanel + View.LayoutDockId.ToString() 
cmd.AutoPostBack = False ' this command is handled on the client 
cmd.OnClientCommand = "showToolTip" 
cmd.Text = "Configuration Panel" 
 

So, the user clicks the custom command button on the RadDock, the ToolTip (with IFrame) is shown, and the IFrame content is customized to the dock the user clicked on. 

As I say, this works fine with the Q3.1208 release, but the Q3.1314 release breaks it.  The behavior is that the tooltip is shown with only the Text inside it (Configuration Panel).  The IFrame codebehind does get called (I observe while debugging), but the content is never shown.  It's the same if I replace the IFrame with plain text. 

The "break" seems to happen with the set_targetControl function.  It (correctly) moves the ToolTip to the right control, but it seems to be hiding the content.  If I remove that line from the Javascript, it functions correctly, except the ToolTip is not positioned where I want it.

Am I doing something wrong, or is there a problem with Q3.1314?

Thank you!


13 Answers, 1 is accepted

Sort by
0
Svetlina Anati
Telerik team
answered on 26 Feb 2010, 10:22 AM
Hi Patrick,

I examined your code and I noticed that you get the command by using the syntax args.Command - would
you please test with command (replace the capital C with lower case c as tooltip.set_targetControl(args.command.get_element());  ) ? JavaScript is case sensitive and thus it considers Command and command different things and thus if args.Command is null you will get a js error when calling get_element. This also explains why when you remove this line the js error disappears.

All the best,
Svetlina
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Quinten
Top achievements
Rank 1
answered on 26 Feb 2010, 05:21 PM
Hi Svetlina,

Thank you for your reply.  Let me clarify: I'm not getting a Javascript error.  I did a little more debugging, and observed that the content of the tooltip is being overridden by the Text property of the Command button.  This did not happen in Q3.1208. 

I was able to fix the problem by re-assigning the content to the tooltip using the "set_contentElement()" method of the tooltip like so:

        function showToolTip(sender, args) { 
            // cause the tooltip to appear near the command icon that triggered it 
            var tooltip = $find("<%=rttConfigPanel.ClientID %>"); 
            var iframe = document.getElementById("iFrameConfigPanel"); 
 
            tooltip.show(); 
            tooltip.set_targetControl(args.Command.get_element()); 
            tooltip.set_contentElement(iframe); 
 
            // send a fresh querystring to the config panel so it doesn't load from cache 
            var sURL = "WidgetConfigPanel.aspx"
            var oDate = new Date(); 
            sURL = sURL + "?id=" + args.Command.get_name(); 
            sURL = sURL + "&RandomNumber=" + oDate.getHours() + "-" + oDate.getMinutes() + "-" + oDate.getMilliseconds(); 
            iframe.src = sURL; 
        } 
 

For anyone else experiencing this problem, please note that you have to invoke .show() on the tooltip before you invoke .set_contentElement(), or you'll get a null reference error.  I didn't see any difference in invoking .set_targetControl() before or after .show().

Svetlina, I did try your suggestion about changing .Command to .command; it works either way, oddly enough.

Thanks for your help!


0
Svetlina Anati
Telerik team
answered on 03 Mar 2010, 03:04 PM
Hello Patrick,

I am glad that you were able to solve the problem.

As to your observation about calling show before set_contentElement it is correct. This is so because the RadToolTip has lazy initialization in order to improve performance and resources usage and this means that it creates the UI on demand, when show is called. Since the set_contentElement appends the content element to the content cell you should ensure that it has already been created by calling the method show first.

As to the command property casing, I assume that it might be still working due to backwards compatibility for the RadControls for ASP.NET. However, I recommend to use command and the ajax naming convention when working with RadControls for ASP.NET AJAX.


All the best,
Svetlina
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Quinten
Top achievements
Rank 1
answered on 04 Mar 2010, 07:17 PM
Hi Svetlina...

Do you have any idea why the tooltip is losing its assigned content, requiring me to re-assign it with "set_contentElement()"?  As I say, it was working in Q3.1208, but stopped working in Q3.1314.  Is this the expected behavior?

Thank you!
0
Svetlina Anati
Telerik team
answered on 08 Mar 2010, 03:32 PM
Hi Patrick,

Would you please provide more details when the content is lost? If it is the same tooltip for the same target and no ajax request/postback has happened this should not happen. It will be best if you share the full page source code which is runnable according with reproduction steps and I will see what is actually happening.


Kind regards,
Svetlina
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Nik
Top achievements
Rank 1
answered on 04 Nov 2011, 10:16 PM
Was a reason for this ever found? I just upgraded to Q3.1317 and ran into the same exact issue.
0
Marin Bratanov
Telerik team
answered on 07 Nov 2011, 01:28 PM
Hi Nik,

We have not received a project that reproduces this behavior, so the suggestions my colleagues has offered previously are still valid - make sure the JavaScript casing is correct and that you are not trying to access it (the tooltip) before its UI is created (i.e. before the OnClientShow event).

What I suspect is also happening in your case is that the priority of the ToolTip contents is not what you expect and therefore your content gets overridden by the title property of the target HTML element (or alt, if this is an image). More information on the order of precedence can be found in this help article. I also advise that you add some timeout before calling show() after changing the targetControlID of the tooltip to allow it to position properly - for example 20ms should suffice.


Kind regards,
Marin
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
0
Nik
Top achievements
Rank 1
answered on 17 Nov 2011, 03:53 PM
What can I do if there is no JS controlling the show of the tooltip? It seems to work fine for text w/ a tooltip assigned, but for images w/ tooltip assigned I'm only getting the images' alt value inside.

<b>Catalog Priority Code</b>:   <a href="#"><img src="/images/site/bttn_question.gif" border="0" width="19" height="19" alt="Help" align="absmiddle" id="imgHelpPC" runat="Server" /></a>
                <br />
                <rad:RadToolTip Width="200px" Height="100" ID="radHelpPcTT" RelativeTo="element" TargetControlID="imgHelpPC"
                    runat="server" Position="TopRight" Title="Priority Code" Skin="Default" AutoCloseDelay="20000">
                    <p>
                        The priority code is located in the yellow box on the back of your catalog or on
                        the address label to the right of your name on other mail pieces.
                        <br />
                        <br />
                        The number will start with a C or P and follow with 9 numbers - C1-2345-6789.
                        <br />
                        <br />
                        In order to use a Purchase Order online you will need to complete the Priority Code.
                    </p>
                </rad:RadToolTip>
0
Marin Bratanov
Telerik team
answered on 18 Nov 2011, 04:21 PM
Hi Nik,

Please examine the following help article for detailed information on the order in which the RadToolTip obtains its content: http://www.telerik.com/help/aspnet-ajax/tooltip-content.html.

It is designed as a replacement for the regular browser tooltip and therefore properties that result in a regular tooltip have high priority. The alternative text for an image is one of those.

You can override this by settings the IgnoreAltAttribute property to true as explained in the help article.


Best wishes,
Marin
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
0
Nicolaï
Top achievements
Rank 2
answered on 22 Nov 2011, 10:06 AM
Hello Marin,

I'm also getting trouble with Q3 set_targetControl and show()...
Really troubling, as I've been using this technique in MANY places... More than I count... It had become my standard...
Never needed a timeout before. It was much faster than using the radtooltipmanager when using it in grids..
Trying to upgrade my projects to Q3, but I keep running into issues! :,(
Having used the Telerik controls for a while now, it's the first time I ever get so many problems when upgrading.

Edit:
The "quick fix" that works for me is to attempt to set the: set_targetControl as early as possible in the javascript logic.
Still a minor problem, mainly because I've been copy pasting the same function a LOT of places, that gets called when a webservice is successful:
function showSavedTT() {CloseToolTip();var tt=$find("<%= savedTT.ClientID %>");tt.set_targetControl($get(ctrlId));tt.show();return false;}
So now I have to move the set_targetControl part to earlier parts of the code (befor the webservice call). This probably has the same effect as a small timeout.

Best regards,
Nicolaï
0
Marin Bratanov
Telerik team
answered on 23 Nov 2011, 02:13 PM
Hi Nicolaï,

I am sorry to hear you are experiencing difficulties in upgrading, yet we are here to assist you in the process.

As for setting the target control - the timeout is necessary and your solution to move the set_targetControlID() earlier in the code does the same - the time the webservice would take to run and return a result acts the same as this timeout.

There is now a sticky thread dedicated to this scenario and you can find it here: http://www.telerik.com/community/forums/aspnet-ajax/tooltip/changing-targetcontrol-on-the-client.aspx.


Regards,
Marin
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
0
Nicolaï
Top achievements
Rank 2
answered on 23 Nov 2011, 02:32 PM
Still a happy customer, the support system is very efficient.

So this will not be changed back, so that it works as before, in a future SP?
Was hoping I wouldn't have to change the code, but rather wait for an update..
It affects so many places in my projects, as I wrote, so I really need to know if this behaviour will be updated, before I start changing code.
0
Marin Bratanov
Telerik team
answered on 23 Nov 2011, 02:46 PM
Hi Nicolaï,

We are considering the options here, yet the fix that requires this timeout is also for a very common scenario, so it is not that easy to just remove it. A possible solution in the future would be a second argument to set_targetControl() and set_targetControlID() that will alter the logic - either the longer code with the fix, or short one without the fix (that will not require timeout). In both cases there will be some change required in your code and actually I cannot guarantee that this will make it into the code as it is a working concept for the time being. Once there is a change in this behavior it will be properly announced in the release notes, it will be reflected in the documentation and the sticky thread will be updated accordingly.


Best wishes,
Marin
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
Tags
ToolTip
Asked by
Quinten
Top achievements
Rank 1
Answers by
Svetlina Anati
Telerik team
Quinten
Top achievements
Rank 1
Nik
Top achievements
Rank 1
Marin Bratanov
Telerik team
Nicolaï
Top achievements
Rank 2
Share this question
or