ASP.NET MVC Tooltip Overview

Telerik UI for ASP.NET MVC Ninja image

The Tooltip is part of Telerik UI for ASP.NET MVC, a professional grade UI library with 110+ components for building modern and feature-rich applications. To try it out sign up for a free 30-day trial.

The Telerik UI Tooltip HtmlHelper for ASP.NET MVC is a server-side wrapper for the Kendo UI Tooltip widget.

The Tooltip displays a popup hint for a specific HTML element. Its content can be defined either as static text or loaded dynamically with AJAX.

Initializing the Tooltip

The following example demonstrates how to define the Tooltip.

   <span id="tooltip" class="k-button wider">Hover me!</span>

    @(Html.Kendo().Tooltip()
        .For("#tooltip")
        .Position(TooltipPosition.Top)
        .Content("Hello!")
    )

Basic Configuration

The following example demonstrates the basic configuration of the Tooltip HtmlHelper.

    <span id="tooltip" class="k-button wider">
        <a href="#">Hover me</a>
    </span>

    @(Html.Kendo().Tooltip()
            .For("#tooltip")
            .Position(TooltipPosition.Top)
            .Content("Hello!")
            .Width(120)
            .AutoHide(false)
            .Filter("a")
            .Events(events => events.Hide("onHide").Show("onShow"))
        )

    <script>

        function onHide() {
            // Hide Event function handler
        }

        function onShow() {
            // Show Event function handler
        }
    </script>

Functionality and Features

Events

For a complete example on basic Tooltip events, refer to the demo on using the events of the Tooltip.

Referencing Existing Instances

To reference an existing Tooltip instance, use the jQuery.data() configuration option. Once a reference is established, use the Tooltip client-side API to control its behavior.

    // Place the following after your Telerik UI Tooltip for ASP.NET MVC declaration.
    <script>
        $(document).ready(function() {
            // The For() configuration option of the Tooltip is used to get its client-side instance.
            var tooltip = $("#tooltip").data("kendoTooltip");
        });
    </script>

See Also

In this article