Hide all RadToolTips on page upon OnItemDragStarted from RadListView

6 posts, 1 answers
  1. Mick
    Mick avatar
    40 posts
    Member since:
    Oct 2006

    Posted 22 Feb 2012 Link to this post

    I have a number of RdToolTips within 2 RadListView's on a page.

    When i drag one element from one RadListView to the other RadListView the RadToolTips keep showing up on mouse hover (as expected on hover).

    How can i in Javascript disable all the RadToolTips on the page when OnItemDragStarted client event for RadListView. Thus stopping the RadToolTips from showing up upon hover only when im dragging an element from one RadListView to another.

    Any help would be greatly apreciated.

  2. Svetlina Anati
    Admin
    Svetlina Anati avatar
    2795 posts

    Posted 23 Feb 2012 Link to this post

    Hello Mick,

    The easiest solution which comes first in my mind is the following one:

    1) Define a global js flag, e.g toCancel to false
    2) Handle the OnItemDragStarted and set the global js variable defined in 1) to true
    3) Handle the OnClientDropped and set the global js flag back to false
    4) Attach a OnClientBeforeShow handler for the tooltip(s) and call sender.set_cancel(toCancel) there. This will cancel the show in case an item is being dragged when the tooltip should show.

    I hope that my reply is detailed enough and helpful, let me know how it goes.

    All the best,
    Svetlina Anati
    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Mick
    Mick avatar
    40 posts
    Member since:
    Oct 2006

    Posted 23 Feb 2012 Link to this post

    Hi Svetlina

    I have tried your solution but im getting an error, i have the following code
    var toCancel = false;
    function CancelToolTip(sender, args){
     sender.set_cancel(toCancel);
    }
     
    function itemDragStarted(sender, args) {
      toCancel = true;
    }
     
    function itemDropped(sender, args) {
      toCancel = false;
    }

    My RadToolTips are as follows:

    <telerik:RadToolTip ID="RadToolTip2" runat="server" TargetControlID="Image1" Width="400px" CssClass="RTP" RelativeTo="Element" EnableShadow="true" Position="BottomCenter" Animation="Slide" OnClientBeforeShow="CancelToolTip(this)"
    AnimationDuration="300" ShowDelay="200" Skin="Vista" ShowEvent="OnMouseOver" HideEvent="LeaveToolTip" RenderInPageRoot="True">
    <div>Test Info</div>
    </telerik:RadToolTip>

    The error im getting is that set_cancel is not recognised
    Any ideas what im doing wrong here?


  5. Svetlina Anati
    Admin
    Svetlina Anati avatar
    2795 posts

    Posted 23 Feb 2012 Link to this post

    Hello Mick,

     The problem comes from the fact that you have incorrectly attached the client handler of the tooltip. You should attach it in the same manner as you attach any other client handlers for RadControls - without the brackets (which will cause immediate call instead of attach event handler) and you do not need to pass this - the tooltip will be passed as sender automatically.

    This being said I suggest to keep the code as it is but to change the markup as follows:

    <telerik:RadToolTip ID="RadToolTip2" runat="server" TargetControlID="Image1" Width="400px" CssClass="RTP" RelativeTo="Element" EnableShadow="true" Position="BottomCenter" Animation="Slide" OnClientBeforeShow="CancelToolTip"
      
    AnimationDuration="300" ShowDelay="200" Skin="Vista" ShowEvent="OnMouseOver" HideEvent="LeaveToolTip" RenderInPageRoot="True">
      
    <div>Test Info</div>
      
    </telerik:RadToolTip>


    Please, test my suggestion and let me know how it goes.

    Greetings,
    Svetlina Anati
    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.
  6. Mick
    Mick avatar
    40 posts
    Member since:
    Oct 2006

    Posted 23 Feb 2012 Link to this post

    Hi

    Ive tried what you have suggested but i still get an error on set_cancel
    I think this is not part of the RadToolTip api properties.
  7. Answer
    Svetlina Anati
    Admin
    Svetlina Anati avatar
    2795 posts

    Posted 23 Feb 2012 Link to this post

    Hi Mick,

     
    Please, accept my sincere apologies for my mistake - you should call the set_cancel method of the args object, not to the sender. This means to keep the last markup (no brackets and no passing this) and only change the js client handler as follows:


    function CancelToolTip(sender, args){
      
     args.set_cancel(toCancel);
      
    }




    All the best,
    Svetlina Anati
    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.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017