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

Showing Tooltip Conditionally

2 Answers 169 Views
ToolTip
This is a migrated thread and some comments may be shown as answers.
Kishan Gandikota
Top achievements
Rank 1
Kishan Gandikota asked on 28 Oct 2009, 04:08 AM

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">  
            </telerik:RadToolTipManager> 

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

protected void Page_Load(object sender, EventArgs e)
{  
    if(!page.IsPostback)
         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." 
 
        e.UpdatePanel.ContentTemplateContainer.Controls.Add(ctrToolTip);  
    }              

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 Answers, 1 is accepted

Sort by
0
Accepted
Svetlina Anati
Telerik team
answered on 30 Oct 2009, 01:24 PM
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:

http://demos.telerik.com/aspnet-ajax/tooltip/examples/webserviceandshow/defaultcs.aspx

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,
Svetlina
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.
0
Kishan Gandikota
Top achievements
Rank 1
answered on 31 Oct 2009, 07:35 PM
Hi Svetlina,

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

Regards,
Kishan G K
Tags
ToolTip
Asked by
Kishan Gandikota
Top achievements
Rank 1
Answers by
Svetlina Anati
Telerik team
Kishan Gandikota
Top achievements
Rank 1
Share this question
or