Showing Tooltip Conditionally

3 posts, 1 answers
  1. Kishan Gandikota
    Kishan Gandikota avatar
    44 posts
    Member since:
    Sep 2009

    Posted 27 Oct 2009 Link to this post

    Hi Telerik Team,

    I have some clarification with respect to the behavior of RAD Tooltip. Is there a posibility that tooltip can open only if some conditions are true? Let me brief out my problem and what I am looking at.

    ASPX: I have  created a tooltip manager as shown below.

    <telerik:RadToolTipManager ID="radToolTipManager" runat="server" Width="600" Height="50" 
                    EnableEmbeddedBaseStylesheet="false" EnableEmbeddedSkins="false" Skin="PortfolioPopup" 
                    OffsetY="-7" OffsetX="0" RelativeTo="Element" Position="BottomRight" HideEvent="ManualClose" 
                    ShowEvent="OnClick" ManualClose="True" OnAjaxUpdate="radToolTipManager_AjaxUpdate">  

    code-bedind: In Page_Load Event, I am adding this code.

    protected void Page_Load(object sender, EventArgs e)
             radToolTipManager.TargetControls.Add(hypConfirm.ClientID, true);  

    I have created tooltip manager since I am adding this to many other controls on my page. "hypConfirm" is a hyperlink which has added in aspx.

    When user clicks on "Confirm", my AJAX method "radToolTipManager_AjaxUpdate" gets called. I am doing some database operations on this method in server side. Only if my database insert/update is successful, I would need to show the popup. I have shared my code below.

    protected void radToolTipManager_AjaxUpdate(object sender, ToolTipUpdateEventArgs e)  
        bool updateSuccess = InsertToDatabase("A");  
        if (updateSuccess)  
            Control ctrToolTip = Page.LoadControl("Tooltip.ascx");  
            (ctrToolTip as ToolTipMessage).Title = "Status";  
            (ctrToolTip as ToolTipMessage).Message = "Database insertion is confirmed." 

    Problem what I am facing is as soon as I clickthe Confirm button, tooltip gets displayed with 'X' button and loading happens. After the above code executed, tooltip shows up. If the above method fails, then it just shows the tooltip with 'X' button it.  I am just using this tooltip to show it as Confirmation message. If my database operation is successful, then I need to show the pop-up with the confirmation message.

  2. Answer
    Svetlina Anati
    Svetlina Anati avatar
    2795 posts

    Posted 30 Oct 2009 Link to this post

    Hi Kishan,

    As far as I understood from your explanations, you want to execute some server side check and then show or not a tooltip based on it. If so, I suggest to use a separate RadToolTip control and to call its method Show() as explained in the demo below:

    Note, that to use this approach you should use ShowEvent="FromCode".

    In case my suggestion does not help or you need further assistance, do not hesitate to contact us again.

    All the best,
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  3. DevCraft R3 2016 release webinar banner
  4. Kishan Gandikota
    Kishan Gandikota avatar
    44 posts
    Member since:
    Sep 2009

    Posted 31 Oct 2009 Link to this post

    Hi Svetlina,

    Thanks a lot. I changed the ShowEvent to FromCode and wrote a event handler for Confirm Button. Conditionally I am making the to fix my problem... Your guidence for my problem worked...thanks a lot...

    Kishan G K
Back to Top