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 Q1 2012 released 04/11/2012
select
  • Rate / Review
    • Give your Feedback:

      Rate this demo:


ToolTip / Load on Demand

Select a product category from the list:

Choose product type:
  • Beverages
  • Condiments
  • Confections
  • Dairy Products
  • Grains/Cereals
  • Meat/Poultry
  • Produce
  • Seafood

  • Chai

  • Chang

  • Guaraná Fantástica

  • Sasquatch Ale

  • Steeleye Stout

  • Côte de Blaye

  • Chartreuse verte

  • Ipoh Coffee

  • Laughing Lumberjack Lager

  • Outback Lager

  • Rhönbräu Klosterbier

  • Lakkalikööri

  • Loading on Demand with AJAX in RadToolTip


    Both RadTooltip and RadTooltipManager can display rich content (including user controls and other ASP.NET controls).


    RadTooltip

    Rich content can be added to RadTooltip can be set to the tooltip in two ways:

    1. Declaring it between the opening and closing tags, e.g.:

    <telerik:RadToolTip runat="server" ID="RadToolTip1" Width="250px" Height="300px" >
    Rich content:
    <asp:Button ID="btnA" runat="server" Text="Button in a ToolTip"/>
    </telerik:RadToolTip>

    2. Adding controls from the code-behind to the RadToolTip.Controls collection, e.g:

    this.RadToolTip1.Controls.Add(new HtmlGenericControl("HR"));


    RadTooltipManager

    RadTooltipManager supports the OnAjaxUpdate event, which triggers an AJAX call to the server when the user moves the mouse over a particular tooltip element on the client.
    The event handler receives the ID of the client element being hovered. This allows for dynamically loading and displaying rich data content for a particular element on demand.
    The feature helps keep page sizes small and manageable, allowing for rich content to be sent to the client only if requested.

    The elements for which RadTooltipManager will throw an AJAX event on the server must have their ClientID's added to the TargetControls collection.

    <telerik:RadToolTipManager runat="server"
    ID
    ="RadToolTipManager1"
    Width
    ="250px"
    Height
    ="300px"
    Animation
    ="Resize"
    OnAjaxUpdate
    ="OnAjaxUpdate">
        
    <TargetControls>
            
    <telerik:ToolTipTargetControl TargetControlID="Link1" IsClientID="true" Value="ValueForLink1" />
            <
    telerik:ToolTipTargetControl TargetControlID="Link2" IsClientID="true" Value="ValueForLink2" />
        </
    TargetControls> 
    </telerik:RadToolTipManager>

    Target controls can also be added from the codebehind in the following manner:

    RadToolTipManager1.TargetControls.Add(image.ID);//The server ID is taken into consideration
    RadToolTipManager1.TargetControls.Add(image.ClientID, true);//The client ID is taken into consideration
    RadToolTipManager1.TargetControls.Add(image.ClientID, "Value"true);//A specific value is associated with this target

Source Code

C# VB.NET
Show code in new window Demo isolation steps
  • <%@ Page Language="c#" CodeFile="DefaultCS.aspx.cs" Inherits="Telerik.Web.Examples.ToolTip.LoadOnDemand.DefaultCS"
        EnableEventValidation="false" ViewStateEncryptionMode="Never" EnableViewStateMac="false" %>

    <%@ Register Src="ProductDetails.ascx" TagName="ProductDetails" TagPrefix="uc1" %>
    <%@ 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" %>
    <!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 ID="Headtag1" runat="server" />
        <link rel="Stylesheet" href="StyleSheet.css" />
    </head>
    <body class="BODY">
        <script type="text/javascript">

            var combo = null;
            function CloseActiveToolTip()
            {
                var tooltip = Telerik.Web.UI.RadToolTip.getCurrent();
                if (tooltip) tooltip.hide();
            }

            function OnClientHide(sender, args)
            {
                if (combo)
                {
                    $find(combo).hideDropDown();
                }
            }
        
        </script>
        <form id="Form1" method="post" runat="server">
        <qsf:Header ID="Header1" runat="server" NavigationLanguage="c#" ShowSkinChooser="false" />
        <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
        </telerik:RadScriptManager>
        <telerik:RadToolTipManager runat="server" ID="RadToolTipManager1" Position="Center"
            RelativeTo="Element" Width="400px" Height="200px" Animation="Resize" HideEvent="LeaveTargetAndToolTip"
            Skin="Default" OnAjaxUpdate="OnAjaxUpdate" OnClientHide="OnClientHide"
            RenderInPageRoot="true" AnimationDuration="200">
        </telerik:RadToolTipManager>
        <telerik:RadFormDecorator ID="decorator" runat="server" Skin="Default" DecoratedControls="Buttons" />
        <qsf:InformationBox ID="InformationBox1" runat="server" Title="Select a product category from the list:">
        </qsf:InformationBox>
        <div style="float: right; margin-top: 10px; width: 260px; background-color: #DDDDDD;
            height: 275px; text-align: center;">
            <span style="height: 25px; display: block; margin-top: 25px;" class="title">Choose product
                type:</span>
            <telerik:RadListBox runat="server" ID="RadListBox1" Height="200px" Width="200px"
                DataSourceID="SqlDataSource2" DataTextField="CategoryName" Skin="Default" AutoPostBack="true"
                Style="text-align: left; margin-bottom: 20px; font-size: 10pt; font-family: Calibri, Arial;"
                OnSelectedIndexChanged="ListBox_SelectedIndexChanged" DataValueField="CategoryID">
            </telerik:RadListBox>
        </div>
        <div class="wrapper">
            <ul>
                <asp:Repeater ID="repeater1" runat="server" DataSourceID="SqlDataSource1" OnItemDataBound="repeater1_ItemDataBound">
                    <ItemTemplate>
                        <li>
                            <div id="smallImage" runat="server">
                                <div style="width: 130px; height: 130px; background-position: center; background-repeat: no-repeat;
                                    background-image: url('<%# Eval("ProductID", "../../../Img/Northwind/Products/Thumbs/{0}.jpg") %>');">
                                </div>
                            </div>
                            <div style="height: 70px; width: 130px;">
                                <hr style="width: 30px; margin-left: 10px; text-align: left;" />
    <asp:Label ID="lblName" runat="server" Style="margin-left: 10px; display: block;
    font-size: 11pt;"><%# Eval("ProductName")%></asp:Label></div>

                        </li>
                    </ItemTemplate>
                </asp:Repeater>
            </ul>
        </div>
        <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString %>"
            ProviderName="System.Data.SqlClient" SelectCommand="SELECT * FROM [Products] WHERE ([CategoryID] = @CategoryID2)">
            <SelectParameters>
    <asp:ControlParameter ControlID="RadListBox1" Name="CategoryID2" PropertyName="SelectedValue"
    Type="Int32" />

            </SelectParameters>
        </asp:SqlDataSource>
        <asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString %>"
            ProviderName="System.Data.SqlClient" SelectCommand="SELECT [CategoryID], [CategoryName] FROM [Categories]">
        </asp:SqlDataSource>
        <qsf:Footer runat="server" ID="Footer1" />
        </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-2012 © Telerik. All right reserved
Telerik Inc, 201 Jones Rd, Waltham, MA 02451