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

multiple HideEvents?

5 Answers 127 Views
ToolTip
This is a migrated thread and some comments may be shown as answers.
Clayton
Top achievements
Rank 1
Clayton asked on 28 Dec 2010, 07:46 PM
Is it possible to have a tooltip with multiple HideEvents? For example, to have ManualClose and FromCode specified so that the tooltip can either be closed by the user or closed from server-side?

5 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 29 Dec 2010, 07:40 AM
Hello Clayton,

You can achieve the desired functionality by invoking client side method using RadAjax Manager. Here is the sample code for closing the tooltip on a ButtonClick event.

aspx:
<asp:Label ID="Label1" runat="server" Text="Label" ToolTip="AAAAAAAAAA"></asp:Label>
<telerik:RadToolTip ID="RadToolTip1" runat="server" TargetControlID="Label1" Sticky="true"
           ManualClose="true">
</telerik:RadToolTip>
<asp:Button ID="Button1" runat="server" Text="Button" OnClick="Button1_Click" />
 <asp:Panel ID="Panel1" runat="server" Height="50px" Width="125px">
</asp:Panel>
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
       <AjaxSettings>
               <telerik:AjaxSetting AjaxControlID="Button1">
                   <UpdatedControls>
                       <telerik:AjaxUpdatedControl ControlID="Label1" />
                   </UpdatedControls>
               </telerik:AjaxSetting>
       </AjaxSettings>
</telerik:RadAjaxManager>

Javascript:
function CloseToolTip()
            {
                var toolTip = $find('RadToolTip1');
                toolTip.hide();
            }

code behind:
protected void Button1_Click(object sender, EventArgs e)
    {
        this.RadAjaxManager1.ResponseScripts.Add("CloseToolTip();"); 
     }

Shinu.
0
Clayton
Top achievements
Rank 1
answered on 29 Dec 2010, 11:05 PM

Thanks for the suggestion, but I'm having issues implementing this:

1) There's a server-side button click event that I added the responsescripts.add() section to, however the event also pushes a file to the user to download (using response.write). Adding this to the radajaxmanager corrupts the file that is being pushed to the user. 

2) I am using a radajaxmanagerproxy, and thus have to use :

RadAjaxManager.GetCurrent(Page).ResponseScripts.Add("CloseToolTip();")
Is this correct? It still does not resolve issue #1 above though..

0
Shinu
Top achievements
Rank 2
answered on 30 Dec 2010, 10:47 AM
Hello,

There are many ways to execute client side function from code behind. The blog mentions some methods that you can follow. Just try with the suggestions in the blog and see whether that helps.
Executing JavaScript function from server-side code


-Shinu.
0
Clayton
Top achievements
Rank 1
answered on 30 Dec 2010, 06:48 PM

I think there's a misunderstanding on what is happening. On my page, I'm using a radajaxmanager, and registering controls individually for ajax update.

The user clicks on a button, is presented with a radtooltip, makes a selection of some parameters in the tooltip, and then clicks another button 'export'

This fires a serverside event that generates a binary file and pushes it back to the user. If I place any code in this event to hide the tooltip, it does nothing. If i register the tooltip to be updated by the 'export' button in the radajaxmanager, it corrupts the binary file that is sent to the user.

It would seem that the radajaxmanager ajax update is interfering with the response.write() that is used to send the user the file?

0
Clayton
Top achievements
Rank 1
answered on 30 Dec 2010, 07:14 PM

I was able to get this working as expected by running this onClientClick event of the button:

function CloseToolTip() {
 
    var tooltip = Telerik.Web.UI.RadToolTip.getCurrent();
    if (tooltip) {
        tooltip.hide();
    }
    return true;
}

It closes the tooltip the the button is clicked, without interfering with the response.write() that pushes the file to the user, and without having to mess with the radajaxmanager.

Tags
ToolTip
Asked by
Clayton
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Clayton
Top achievements
Rank 1
Share this question
or