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

client-side set_position exception

2 Answers 113 Views
ToolTip
This is a migrated thread and some comments may be shown as answers.
Antony Corbett
Top achievements
Rank 1
Antony Corbett asked on 28 Apr 2008, 10:03 AM
Hi,
In server side, I created a tooltip like this:
<telerik:RadToolTip ID="RadToolTip1" runat="server" Skin="Web20"
       Animation="Resize" AutoCloseDelay="5000" EnableViewState="False"
       RelativeTo="Element" ShowEvent="FromCode" Position="ButtomLeft">
     </telerik:RadToolTip>

In client-side, my script does:
        var tooltip = $find(this.get_tooltipId());
        if (tooltip)
        {
          tooltip.set_targetControl(AControl.get_element());
          tooltip.set_title("Some title");
          tooltip.set_text("Some text");
          tooltip.set_position("MiddleRight"); // !where the error occurs!
          tooltip.show();
        }
If I commented out the line that changes the default position, everything works fine. But when I tried to change the position, I got an exception from Sys.UI.Bounds = function Sys$UI$Bounds(x, y, width, height), where y is set to NaN and X is -322 which I think both wrong.

Any idea?

2 Answers, 1 is accepted

Sort by
0
Tervel
Telerik team
answered on 29 Apr 2008, 08:45 AM
Hello Antony,

The Position property is not of type string, but it is enumerable type. When setting the property declaratively on the server, the .NET framework allows you to specify it as a string, yet this is not the case if you try to do so from the code-behind, e.g.

//Server-code - compile time error will occur
RadToolTip1.Position = "MiddleRight";

Even more so, the same is valid for the client-side. The property there is not a string, but a client-side enum, and it should be set as such:

tooltip.set_position(Telerik.Web.UI.ToolTipPosition.MiddleRight);


Best regards,
Tervel
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Svetlina Anati
Telerik team
answered on 29 Apr 2008, 03:56 PM
Hello Antony,

I already answered your support ticket and for your convenience I am pasting the answer below:


I suppose that the problem is caused by incorrect usage of the RadToolTip's client-side API.
I prepared a sample project, based on your code and the properties are set as expected. I believe it will be helpful.

Let me know whether you need further assistance.

All the best,
Svetlina
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
ToolTip
Asked by
Antony Corbett
Top achievements
Rank 1
Answers by
Tervel
Telerik team
Svetlina Anati
Telerik team
Share this question
or