client-side set_position exception

3 posts, 0 answers
  1. Antony Corbett
    Antony Corbett avatar
    1 posts
    Member since:
    Mar 2008

    Posted 28 Apr 2008 Link to this post

    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. Tervel
    Admin
    Tervel avatar
    1337 posts

    Posted 29 Apr 2008 Link to this post

    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
  3. Svetlina Anati
    Admin
    Svetlina Anati avatar
    2795 posts

    Posted 29 Apr 2008 Link to this post

    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
Back to Top