update target control when tooltip show

5 posts, 1 answers
  1. Mattia
    Mattia avatar
    11 posts
    Member since:
    Jun 2011

    Posted 14 Jul 2011 Link to this post

    Hello all,
    I have a user control that is made this way.
    There is a RadListView.
    Each item in the list view contains a checkbox.
    Each checkbox is added in the list ot the TargetControls of a TooltipManager.

    When the user click on the checkbox the tooltip correctly show but the checkbox is not checked. I think is due to ajax not updating the checkbox.

    There's a way to solve this?

    Thanks,
    Mattia
  2. Marin Bratanov
    Admin
    Marin Bratanov avatar
    3595 posts

    Posted 14 Jul 2011 Link to this post

    Hello Mattia,

      The checkbox has a default behavior for the click event. When a tooltip targets it with its ShowEvent set to OnClick this overrides the default behavior. You can confirm this without a tooltip as well by simply attaching some JavaScript function to the onclick event. What I would suggest is that you change the ShowEvent to OnMouseOver.


    Greetings,
    Marin
    the Telerik team

    Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Mattia
    Mattia avatar
    11 posts
    Member since:
    Jun 2011

    Posted 14 Jul 2011 Link to this post

    Hello Marin,
    when I try the mouseover the tooltip appear and disappear continuosly.
    Is it possibile to use the ShowEvent="FromCode" and open it from javascript? Can you provide an example. I found an example with HideEvent="FromCode" but i cannot find one with ShowEvent="FromCode".

    Also, is it normal that for every postback raised by the controls in the tooltip i always have an OnAjaxUpdate.

    Thanks,
    Mattia
  5. Answer
    Marin Bratanov
    Admin
    Marin Bratanov avatar
    3595 posts

    Posted 19 Jul 2011 Link to this post

    Hello Mattia,

    This behavior may be observed because of the way the mouseover and mouseout events work - they are thrown quite often and especially for small elements such as the checkboxes.  For some more information on the matter please examine the following article: http://www.quirksmode.org/js/events_mouse.html. You can try setting the HideDelay property to some larger value to try to work around the mouseout event hiding the tooltip too often.

    When using the ToolTipManager with the OnAjaxUpdate event the user control is actually loaded inside an update panel, which means that a postback from within will result in an AJAX request, which goes through the whole page lifecycle on the server (and the user control is still a part of the page), so, yes, it is normal.

    As for an example with the ShowEvent = FromCode - it would result in the same behavior as the OnMouseOver (as it actually uses is internally), yet here it is:
        <telerik:RadToolTip ID="RadTooltip1" runat="server" ShowEvent="FromCode" ShowDelay="0" HideDelay="100"
            IsClientID="true" Position="BottomLeft" RelativeTo="Element" Height="50px" Width="120px"
             HideEvent="FromCode">
            Content for the tooltip
        </telerik:RadToolTip>
      
    <asp:CheckBox runat="server" ID="checkbox1" onmouseover="showToolTip(this)" onmouseout="hideToolTip()" Text="this is a checkbox" />

    and the JavaScript:
    function showToolTip(trigger)
    {
        var tooltip = $find("RadTooltip1");
        if (tooltip != null)
        {
            tooltip.set_targetControl(trigger);
            tooltip.show();
        }
    }
     
    function hideToolTip()
    {
        var activeTooltip = Telerik.Web.UI.RadToolTip.getCurrent();
        if (activeTooltip)
        {
            activeTooltip.hide();
        }
    }


    Best wishes,
    Marin
    the Telerik team

    Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

  6. Mattia
    Mattia avatar
    11 posts
    Member since:
    Jun 2011

    Posted 20 Jul 2011 Link to this post

    Thanks for the help now is working.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017