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

Modal ToolTip closes on PostBack

1 Answer 59 Views
ToolTip
This is a migrated thread and some comments may be shown as answers.
Steven
Top achievements
Rank 1
Steven asked on 09 Feb 2013, 03:29 PM
I have a Modal ToolTip with ShowEven and HideEvent both set to FromCode.  The ToolTip displays a panel that contains a RadGrid and two buttons.  The Grid is set to allow column filtering.

When I run the page and display the ToolTip it works fine.  However, if I apply a filter, that causes a PostBack which "closes" the ToolTip. I think from other posts I have read that I need to either reshow the ToolTip or "ajaxify" the grid so that the postback is only a partial. 

What's the best approach?  If I decide to reshow the ToolTip, how do I determine that it was supposed to be open?  If I decide to ajaxify the interaction, what settings?  I tried setting the Grid as the Target and the ToolTip as the Updated control but that didn't help.

Steve

1 Answer, 1 is accepted

Sort by
0
Marin Bratanov
Telerik team
answered on 11 Feb 2013, 02:11 PM
Hi Steve,

I believe your other thread with a similar question already contains some useful information on the matter: http://www.telerik.com/community/forums/aspnet-ajax/tooltip/detect-if-tooltip-is-open.aspx.

For the RadGrid - perhaps the easiest way to do this is to wrap it in a RadAjaxPanel and use its client events to store the shown tooltip in order to re-show it after the response ends, e.g.:
<telerik:RadAjaxPanel ID="rapProgress" runat="server" ClientEvents-OnRequestStart="storeTooltip"
    ClientEvents-OnResponseEnd="showLastTooltip">
        <telerik:RadGrid ID="rg1" runat="server">
        <MasterTableView>
            <Columns>
                <telerik:GridTemplateColumn>
                    <ItemTemplate>
                        <asp:HyperLink ID="target" runat="server" Text="View Tooltip"></asp:HyperLink>
                        <telerik:RadToolTip ID="rttLog" runat="server" RelativeTo="Element"
                            Width="200px" TargetControlID="target">
                        </telerik:RadToolTip>
                    </ItemTemplate>
                </telerik:GridTemplateColumn>
            </Columns>
        </MasterTableView>
    </telerik:RadGrid>
</telerik:RadAjaxPanel>
<script type="text/javascript">
    var lastTooltipID = null;
    function storeTooltip()
    {
        lastTooltip = Telerik.Web.UI.RadToolTip.getCurrent();
        if (lastTooltip)
        {
            lastTooltipID = lastTooltip.get_id();
        }
 
    }
    function showLastTooltip()
    {
        if (lastTooltipID)
        {
            setTimeout(function ()
            {
                $find(lastTooltipID).show();
                lastTooltipID = null;
            }, 100);
        }
    }
</script>

If you are using RadAjaxManager you would most likely have to set the RadGrid as the initiator and the grid and tooltip/tooltipmanager as updated controls, e.g.:
<telerik:AjaxSetting AjaxControlID="rg1">
    <UpdatedControls>
        <telerik:AjaxUpdatedControl ControlID="rg1" />
        <telerik:AjaxUpdatedControl ControlID="rttm1" />
    </UpdatedControls>
</telerik:AjaxSetting>
Note that both approaches should be avoided - either the RadAjaxPanel, or RadAjaxManager should be used.

Kind regards,
Marin Bratanov
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
Steven
Top achievements
Rank 1
Answers by
Marin Bratanov
Telerik team
Share this question
or