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

Show/Remove Issue Tooltip in Updatepanel issue.

1 Answer 168 Views
ToolTip
This is a migrated thread and some comments may be shown as answers.
Veenu
Top achievements
Rank 1
Veenu asked on 25 Aug 2010, 11:13 AM
Hi
    We have TooltipManager on master page. The page inheriting master page has image which is binded to Tooltipmanager on master page. I want to show/hide tooltip on button click event which does postback after click. After clicking button, TargetControls of ToolTipManager are added/cleared. This doesn't work  when page is kept in UpdatePanel with UpdateMode=Conditional. The tooltip keeps on displaying on mouseover(should be removed when Hide button clicked).
The client side code for master page is:
    
<telerik:RadScriptManager ID="RadScriptManager1" runat="server" >               
                         
            </telerik:RadScriptManager>     
        <asp:ContentPlaceHolder ID="cpHolder" runat="server">
          
        </asp:ContentPlaceHolder>
        <table runat="server">
            <tr runat="server">
                    <td colspan="2" id="tdAddToolTip" runat="server">
                       <telerik:RadToolTipManager runat="server" ManualClose="true" Position="Center" ManualCloseButtonText="Close" 
                                 ID="rdToolTipManager"   Height="200" Width="350"
                            RelativeTo="Element"   OnAjaxUpdate="OnAjaxUpdate"  ContentScrolling="Default"
                        Skin="Telerik" />
  
                    </td>
                </tr>
        </table>
The server side for master page is:
           protected void Page_Load(object sender, EventArgs e)
        {
            rdToolTipManager.TargetControls.Add("ctl00_cpHolder_img", true);
        }
  
        protected void OnAjaxUpdate(object sender, ToolTipUpdateEventArgs args)
        {
            Label tooltipLabel = new Label();
            tooltipLabel.Text = "Hey it works!!!";
            args.UpdatePanel.ContentTemplateContainer.Controls.Add(tooltipLabel);
        }
The page client side code is:
<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional" >
        <ContentTemplate>
            <asp:ImageButton ImageUrl="~/Images/btn_graph.gif" ID="img" runat="server" />
            <asp:Button ID="btnHide" runat="server" OnClick="btnHide_Click" Text="Hide" />
            <asp:Button ID="btnShow" runat="server" OnClick="btnShow_Click" Text="Show" />
        </ContentTemplate>
            <Triggers>
            <asp:AsyncPostBackTrigger ControlID="btnHide" EventName="Click"></asp:AsyncPostBackTrigger>  
             <asp:AsyncPostBackTrigger ControlID="btnShow" EventName="Click"></asp:AsyncPostBackTrigger>      
       </Triggers>
       </asp:UpdatePanel>
& the server side for the page is:
           protected void Page_Load(object sender, EventArgs e)
        {
        }
        protected void btnHide_Click(object sender, EventArgs e)
        {
            ((Telerik.Web.UI.RadToolTipManager)(this.Page.Master.FindControl("rdToolTipManager"))).TargetControls.Clear();
        }
        protected void btnShow_Click(object sender, EventArgs e)
        {
            ((Telerik.Web.UI.RadToolTipManager)(this.Page.Master.FindControl("rdToolTipManager"))).TargetControls.Add(img.ClientID, true); ;
        }

Please let me know if anyone knows or faced this issue earlier. Is there any other way to remove/show tooltip?

Warm Regards
Veenu

1 Answer, 1 is accepted

Sort by
0
Fiko
Telerik team
answered on 30 Aug 2010, 08:29 AM
Hi Veenu,

I have already answered your support ticket. For convenience I have pasted a part of my answer here:
"The behavior that you experience is the expected one, because the RadToolTipManager is not updated when its TargetControls collection is cleared. I recommend you to wrap the ToolTipManager control in an UpdatePanel with UpdateMode="Conditional". Then you can update the TooltipManager by calling the panel's Update() method:

MaserPage file:

<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
    <ContentTemplate>
        <telerik:RadToolTipManager runat="server" ManualClose="true" Position="Center" ManualCloseButtonText="Close"
            ID="rdToolTipManager" Height="200" Width="350" RelativeTo="Element" OnAjaxUpdate="OnAjaxUpdate"
            ContentScrolling="Default" Skin="Telerik" />
    </ContentTemplate>
</asp:UpdatePanel>

Hide button click handler:
protected void btnHide_Click(object sender, EventArgs e)
{
    ((Telerik.Web.UI.RadToolTipManager)(this.Page.Master.FindControl("rdToolTipManager"))).TargetControls.Clear();
    ((UpdatePanel)(this.Page.Master.FindControl("UpdatePanel1"))).Update();
}
"

Kind regards,
Fiko
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
ToolTip
Asked by
Veenu
Top achievements
Rank 1
Answers by
Fiko
Telerik team
Share this question
or