Telerik is a leading vendor of ASP.NET AJAX, ASP.NET MVC, Silverlight, WinForms and WPF controls and components, as well as .NET Reporting, .NET ORM , .NET CMS, Code Analysis, Mocking, Team Productivity and Automated Testing Tools. Building on its expertise in interface development and Microsoft technologies, Telerik helps customers build applications with unparalleled richness, responsiveness and interactivity. Telerik products help thousands of companies to be more productive and deliver reliable applications under budget and on time.
Version Q2 2011 released 07/12/2011
select

ToolTip / Web Service and Show

You can combine the VisibleOnPageLoad property and the WebService functionality of the RadToolTip manager to make a RadToolTip visible when the page first loads and set its content using a WebService.

Notice the RadToolTip in the bottom right corner of the browser window. You can obtain the up-to-date information in the same manner by pressing the "Check message count" button.



 

 


  •  WebService support and using Show() method

    This example shows how to dynamically show a RadToolTip and set its content using a WebService.

    In order to use a WebService to fetch the information from the server we want to display in the tooltip, we have to use a RadToolTipManager. Combining the RelativeTo and ShowEvent properties, we have configured the RadToolTipManager to never open a RadToolTip unless the Show (either client or server) method is explicitly called and to position the created tooltips relative to the browser window.

    Setting VisibleOnPageLoad to "true" for the RadToolTipManager, "tells" the manager to open the first RadToolTip in its tooltips collection as soon as the page loads.

    Notice the single ToolTipTargetControl we have added to the TargetControls collection of the manager. Since we don't have an element on the page we want to tooltipify, we have to make sure that the tooltips collection of the manager is not empty and we additionally need a way to pass a parameter to the WebService's method. For simplicitly, we have set that parameter to "1" in this example. In real-world scenario, this value could be the identifier of the user that is currently logged in.
    The TargetControlID for this ToolTipTargetControl, is the ID of the FORM element. You can actually set it to any valid ID (of an existing control on the page), but in this particular scenario we use the ID of the FORM element, because:

    • It is a valid ID
    • We have set ShowEvent of the manager to FromCode
    • The FORM element is not meant to be tooltipified.

Source Code

C# VB.NET
Show code in new window Demo isolation steps
  • <%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
    <%@ Register TagPrefix="qsf" Namespace="Telerik.QuickStart" %>
    <%@ Register TagPrefix="qsf" TagName="Header" Src="~/Common/Header.ascx" %>
    <%@ Register TagPrefix="qsf" TagName="HeadTag" Src="~/Common/HeadTag.ascx" %>
    <%@ Register TagPrefix="qsf" TagName="Footer" Src="~/Common/Footer.ascx" %>

    <%@ Page CodeFile="DefaultCS.aspx.cs" Language="c#" AutoEventWireup="true" Inherits="Telerik.Web.Examples.RadToolTip.WebServiceAndShow.DefaultCS" %>

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <qsf:HeadTag runat="server" ID="Headtag1"></qsf:HeadTag>
    </head>
    <body class="BODY">
        <form runat="server" id="mainForm" method="post">
        <qsf:Header ID="Header1" runat="server" NavigationLanguage="C#"></qsf:Header>
        <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
        </telerik:RadScriptManager>
        <div class="bigModule" style="margin-bottom: 40px">
            <div class="bigModuleBottom">
                <p>
                    You can combine the VisibleOnPageLoad property and the WebService functionality
                    of the RadToolTip manager to make a RadToolTip visible when the page first loads
                    and set its content using a WebService.
                </p>
                <p>
                    Notice the RadToolTip in the bottom right corner of the browser window. You can
                    obtain the up-to-date information in the same manner by pressing the "Check message
                    count" button.
                </p>
            </div>
        </div>
        <br />
        <br />
        <telerik:RadToolTipManager ID="RadToolTipManager1" runat="server" Animation="Slide"
            RelativeTo="BrowserWindow" OffsetX="20" OffsetY="20" ShowCallout="false" VisibleOnPageLoad="true"
            ShowEvent="FromCode" Position="BottomRight" Width="220px" Height="60px">
            <WebServiceSettings Method="GetMailMessagesCount" Path="ToolTipWebService.asmx" />
            <TargetControls>
                <telerik:ToolTipTargetControl TargetControlID="mainForm" Value="1" />
            </TargetControls>
        </telerik:RadToolTipManager>

        <script type="text/javascript">
             function CheckMessageCount()
             {        
             $find("<%=RadToolTipManager1.ClientID %>").get_tooltips()[0].show();        
             }
                              
        </script>

        <button onclick="CheckMessageCount(); return false;" class="button">
            Check message count</button>
        <p>
            &nbsp;</p>
        <p>
            &nbsp;</p>
        <qsf:Footer ID="Footer1" runat="server"></qsf:Footer>
        </form>
    </body>
    </html>

Get more than expected!

 
 

Take your time to truly experience the power of RadControls for ASP.NET AJAX with a free 60-day trial backed up by Telerik’s unlimited dedicated support.

Download your RadControls for ASP.NET AJAX trial and jumpstart your development with the available Getting Started resources.

If you have any questions, do not hesitate to contact us at sales@telerik.com.

Copyright 2002-2024 © Telerik. All right reserved
Telerik Inc, 201 Jones Rd, Waltham, MA 02451