Skip to content

Commit d129c13

Browse files
github-actions[bot]KB Bot
and
KB Bot
authored
Added new kb article window-display-tooltip-on-title (#678)
Co-authored-by: KB Bot <[email protected]>
1 parent 235e733 commit d129c13

File tree

1 file changed

+61
-0
lines changed

1 file changed

+61
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
---
2+
title: Adding Tooltip to Title in Telerik RadWindow
3+
description: Learn how to display a tooltip on the title of a Telerik RadWindow on hover.
4+
type: how-to
5+
page_title: How to Display a Tooltip on RadWindow Title on Hover
6+
slug: window-display-tooltip-on-title
7+
tags: radwindow, tooltip, onclientpageload, set_title, asp.net ajax
8+
res_type: kb
9+
ticketid: 1685519
10+
---
11+
12+
## Environment
13+
<table>
14+
<tbody>
15+
<tr>
16+
<td>Product</td>
17+
<td>Progress® Telerik® UI for ASP.NET AJAX RadWindow</td>
18+
</tr>
19+
<tr>
20+
<td>Version</td>
21+
<td>All</td>
22+
</tr>
23+
</tbody>
24+
</table>
25+
26+
## Description
27+
28+
I am using the `set_title()` method to set the title of a Telerik RadWindow. I need to display a tooltip when hovering over the title of the RadWindow. This knowledge base article also answers the following questions:
29+
30+
- How to add a tooltip to the RadWindow title?
31+
- How to use the `OnClientPageLoad` event to modify RadWindow elements?
32+
- How to apply HTML attributes to RadWindow components dynamically?
33+
34+
## Solution
35+
36+
To add a tooltip to the RadWindow title, utilize the [OnClientPageLoad](https://www.telerik.com/products/aspnet-ajax/documentation/controls/window/client-side-programming/events/onclientpageload#onclientpageload) client-side event. This event fires when the RadWindow is loaded on the client. Within this event, obtain a reference to the RadWindow's popup element, find the title span, and add the `title` attribute to it for the tooltip.
37+
38+
1. Define the RadWindow in your ASPX page and assign it an `OnClientPageLoad` event handler:
39+
40+
````ASP.NET
41+
<telerik:RadWindow runat="server" ID="RadWindow1" Width="500" Height="500" VisibleOnPageLoad="false"
42+
OnClientPageLoad="onClientPageLoad" NavigateUrl="https://www.wikipedia.org/">
43+
</telerik:RadWindow>
44+
45+
<telerik:RadButton runat="server" OnClientClicked="OnClientClicked" ID="RadButton1" Text="Show Window" AutoPostBack="false" />
46+
````
47+
48+
2. In the `OnClientPageLoad` event handler, access the RadWindow's popup element, locate the title span, and add a `title` attribute for the tooltip:
49+
50+
````JavaScript
51+
function onClientPageLoad(sender, args) {
52+
let wndElement = sender.get_popupElement();
53+
let titleElement = wndElement.querySelector(".rwTitle");
54+
55+
titleElement.setAttribute("title", "This is a tooltip");
56+
}
57+
````
58+
59+
By adding the `title` attribute to the title span of the RadWindow, the tooltip "This is a tooltip" will be displayed when hovering over the title.
60+
61+

0 commit comments

Comments
 (0)