We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

I wanna add a tooltip to a dialogs


i have several code-generated dialogs on a webpage. Each dialog has its unique id. And there is a possibility, that some stuff on the dialog needs a tooltip as explanation. Well. Tried to add the tooltip with only the tag "Target". Didn't work. I can't use for as the dialogs have different IDs. And as far as I understand the tag "For" is for a single ID.
Then I tried to add the Tooltip to each dialog with this basic code:
          Syncfusion.JavaScript.Web.Tooltip tt = new Syncfusion.JavaScript.Web.Tooltip();
            tt.Content = "ToolTipText";
            tt.Target = ".custom";

            tt.For = dialog.ID;
            tt.ID = dialog.ID + "_tt";
            tt.Width = "180px";

Well. If I put "For" after "ID" it destroys the dialog. And in the webpage it looks like this in the source:


There I'm missing the "For". What am I missing?

3 Replies

PO Prince Oliver Syncfusion Team April 6, 2017 11:50 AM UTC

Hi Carsten,   
Thank you for contacting Syncfusion support.   
The Target attribute is used to specify a selector for the tooltip within the container element. So, it will not work for the other element outside the container. Tooltip will be rendered upon an existing element, hence For attribute is used for specifying the ID of the existing container element which in you case is dialog control.   
Render the tooltip control in aspx page and access its object in the code behind as follows   
<ej:Dialog ID="basicDialog" Content=".control" runat="server"  ClientIDMode="Static" Title="Audi Q3 Drive" > 
        <ej:Tooltip ID="tooltip1" runat="server" ClientIDMode="Static" ></ej:Tooltip> 

protected void Page_Load(object sender, EventArgs e) 
            tooltip1.Content = "ToolTipText"; 
            tooltip1.For = basicDialog.ID; 
            tooltip1.Width = "180px"; 

We have prepared a sample as per your requirement, kindly refer to the following link for the sample: http://www.syncfusion.com/downloads/support/forum/129820/ze/DialogWithTooltip-588936302 

CW Carsten Wuttke April 7, 2017 06:28 AM UTC

Hello Prince,
thx for your reply. But I can't set it in the page. I have to create it by code. Why you ask? Well. Currently I have 10 dialogs (code-generated) that could need a tooltip. But tomorrow someone changes the data that generates the dialogs and there are 20. Then the tooltip should also be generated automatically if needed. And each dialog has a unique ID.

PO Prince Oliver Syncfusion Team April 10, 2017 10:03 AM UTC

Hi Carsten,    

Thank you for your update. 

As per your requirement, you can use a single tooltip to show content based on the dialog for every dialog control. This can be done using target property.  We need to include a common class for dialogs using cssClass property of dialog and set it to target property in tooltip control. This will display tooltip for every dialog control.    

We have prepared a sample, kindly refer to the following link for sample:  http://www.syncfusion.com/downloads/support/forum/129820/ze/DialogWithTooltip-824925310 


Live Chat Icon For mobile
Up arrow icon