Search results

Custom Tooltip with dynamic HTML in ASP.NET Core Tooltip control

08 Apr 2021 / 1 minute to read

Tooltip loads HTML pages via HTML tags such as iframe, video, and map using the content property, which supports both string and HTML tags.

To load an iframe element in tooltip, set the required iframe in the content of tooltip while initializing the tooltip component. Refer to the following code.

Copied to clipboard
content: '<iframe src="https://www.syncfusion.com/products/essential-js2"></iframe>
tagHelper
html-page.cs
Copied to clipboard
<div id="container">
        <ejs-tooltip id="target" cssClass="e-tooltip-css" opensOn="Click" width="350" height="250" content="<iframe src='https://www.syncfusion.com/products/essential-js2' id='tooltipFrame'></iframe>">
            <e-content-template>
                <div id="tooltipContent">
                    <div class="content">
                        <button class="text" id="iframeContent">Embedded Iframe</button>
                    </div>
                </div>
            </e-content-template>
        </ejs-tooltip>
    </div>

<style>
#tooltipContent {
    position: relative;
    left: 50%;
    transform: translateX(-50%);
    margin: 65px 10px;
}

.content {
    display: inline-block;
    width: 49%;
}

#tooltipFrame {
    width: 332px;
    height: 233px;
}

.content button {
    position: relative;
    left: 50%;
    transform: translateX(-50%);
}
</style>
Copied to clipboard
public ActionResult TooltipView()
{
    return View();
}