multiple HideEvents?

6 posts, 0 answers
  1. Clayton
    Clayton avatar
    47 posts
    Member since:
    Nov 2009

    Posted 28 Dec 2010 Link to this post

    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?
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 29 Dec 2010 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Clayton
    Clayton avatar
    47 posts
    Member since:
    Nov 2009

    Posted 29 Dec 2010 Link to this post

    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..

  5. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 30 Dec 2010 Link to this post

    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.
  6. Clayton
    Clayton avatar
    47 posts
    Member since:
    Nov 2009

    Posted 30 Dec 2010 Link to this post

    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?

  7. Clayton
    Clayton avatar
    47 posts
    Member since:
    Nov 2009

    Posted 30 Dec 2010 Link to this post

    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.

Back to Top
UI for ASP.NET Ajax is Ready for VS 2017