This is a migrated thread and some comments may be shown as answers.

Adding controls from code behind

1 Answer 472 Views
ToolTip
This is a migrated thread and some comments may be shown as answers.
Swanand
Top achievements
Rank 1
Veteran
Swanand asked on 26 Apr 2020, 05:57 PM

Hi,

I am fairly new to Telerik controls and was experimenting with radtooltip and radtooltipmanager.

 

I created a tooltipmanager and a radtooltip from code behind with ID = "Test", rendermode = lightweight, title = "properties" and text = "CheckText". And this worked.

But when I went to add a radlabel I created as a control to it, saying

RTP.Controls.Add(radlabel1)

it wouldn't display it.

Can someone help me figure how to add controls to radtooltip or radtooltipmanager?

(Eventually, I want to add more controls like a table in the tooltip)

 

Thanks in advanced,

Swanand Nalawade

1 Answer, 1 is accepted

Sort by
0
Accepted
Vessy
Telerik team
answered on 29 Apr 2020, 04:13 PM

Hi Swanand,

The Tooltip can have either Text, or controls in its content. When the Text is set it is considered with a higher priority thank the controls, this is why the added Label is not visible. Removing the added Text should resolve the problem.

For example, you can have a similar setup:

    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            RadToolTip RTP = new RadToolTip();
            RTP.ID = "Test";
            RTP.RenderMode = RenderMode.Lightweight;
            RTP.Width = Unit.Pixel(150);
            RTP.Title = "Properties";
            //RTP.Text = "CheckText";
            RTP.TargetControlID = "Image1";
            RTP.IsClientID = false;
            RTP.ShowEvent = ToolTipShowEvent.OnMouseOver;
            RadLabel lbl = new RadLabel();
            lbl.Text = "Some content coming from a label";

            RTP.Controls.Add(lbl);
            Page.Form.Controls.Add(RTP);
        }
    }

Regards,
Vessy
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.
Tags
ToolTip
Asked by
Swanand
Top achievements
Rank 1
Veteran
Answers by
Vessy
Telerik team
Share this question
or