Tooltip empty after postback when dynamically added in a custom webcontrol.

4 posts, 0 answers
  1. Alain Nagels
    Alain Nagels avatar
    1 posts
    Member since:
    May 2010

    Posted 06 Aug 2010 Link to this post


    We've build a custom web control (not a user control) which adds a RadToolTip dynamically.
    The tooltip is created and added to the Controls-collection of the webcontrol in the OnLoad-event.
    The text of the tooltip is set in the RenderContents-event of the webcontrol.

    This control is used in rows of a RadGrid and it works fine when the page is requested but after a postback the tooltip still appears but the text is empty.

    The difference seems to be that on a page request the telerik tooltip somehow adds statements like :

    Sys.Application.add_init(function() {
        $create(Telerik.Web.UI.RadToolTip, {"_cssClass":"","_manualCloseButtonText":"Close","clientStateFieldID":"ctl00_ctl00_ContentPlaceholder1_MiddleColumn_ctl00_CandidateListGrid_ctl00_ctl04_MessageUSGToolTip_ctl00_ClientState","formID":"aspnetForm","relativeTo":1,"skin":"USGFOEXTelerik","targetControlID":"ctl00_ctl00_ContentPlaceholder1_MiddleColumn_ctl00_CandidateListGrid_ctl00_ctl04_MessageImage","text":"Dit is een bericht verkregen uit hercules:\u003cbr /\u003ede status is ToValidate"}, null, null, $get("ctl00_ctl00_ContentPlaceholder1_MiddleColumn_ctl00_CandidateListGrid_ctl00_ctl04_MessageUSGToolTip_ctl00"));

    When a postback is done these statements are missing.

    Why are these statements missing after a postback? 

  2. Svetlina Anati
    Svetlina Anati avatar
    2795 posts

    Posted 11 Aug 2010 Link to this post

    Hello Alain Nagels,

     The mentioned code is the creating of the client object of teh tooltip. However, I cannot say what is teh problem in your case based only on the provided information. What I can assume is that you have some incorrect AJAX settings or you are dynamically creating controls either at not suitable point of teh page lifecycle or you have not recreated them on next postbacks.

    If the provided assumptions do not help and you need further assistance, please prepare a sample fully runnable reproduction demo (use a fake programmatic datasource if needed), open a new support ticket and send it to us along with step by step instructions and explanations and we will debug it and do our best to help.

    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. Thilo
    Thilo avatar
    3 posts
    Member since:
    Oct 2010

    Posted 08 Dec 2011 Link to this post

    Hy Svetlina

    I have the same issue.
    I do the following:

    protected void Page_Load(object sender, EventArgs e)
                if (!IsPostBack)
                    License = new clLicense();
                    RadTabStrip1.SelectedIndex = 0;
                    licenseFormPage.Selected = true;

    And in the method generateLicenseForm(); I do the following:

    Panel container = new Panel();
                Panel p;
                Table table;
                TableRow row;
                TableCell cell;
                CustomTextBox textBox;
                RadToolTip toolTip;
                RadToolTip toolTip2;
                CustomSaveButton btnSave;
                Label lbl;
                clLicenseGroup group;
                clLicenseProperty prop;
                short tabIndex = 1;
                //Über alle Gruppen iterieren
                for (int i = 0; i < License.LicenseGroups.Count; i++)
                    group = (clLicenseGroup)License.LicenseGroups[i];
                    p = new Panel();
                    table = new Table();
                    p.GroupingText = group.Name;
                    p.CssClass = "keyValuePair";
                    for (int j = 0; j < group.LicenseProperties.Count; j++)
                        prop = (clLicenseProperty)group.LicenseProperties[j];
                         row = new TableRow();
                        //Label erstellen
                        cell = new TableCell();
                        cell.CssClass = "labelCell";
                        lbl = new Label();
                        lbl.Text = prop.TemplateName + ": ";
                        //Textbox erstellen
                        cell = new TableCell();
                        cell.CssClass = "textBoxCell";
                        textBox = new CustomTextBox();                
                        textBox.ID = "txt" + prop.Name;
                        textBox.GroupName = group.Name;
                        textBox.PropertyName = prop.Name;
                        textBox.ToolTip = prop.Description;
                        textBox.CssClass = "valueBox";
                        textBox.EnableViewState = true;
                        textBox.Width = new Unit(400, UnitType.Pixel);
                        textBox.TabIndex = tabIndex;
                        toolTip = new RadToolTip();
                        toolTip.TargetControlID = textBox.ID;
                        toolTip.Text = prop.Description;
                        //Speichernbutton der Eigenschaft erstellen
                        cell = new TableCell();
                        btnSave = new CustomSaveButton();
                        btnSave.CssClass = "btnBox";
                        btnSave.Text = "...";
                        btnSave.ID = "btnSave" + prop.Name;
                        btnSave.GroupName = group.Name;
                        btnSave.PropertyName = prop.Name;
                        //btnSave.Enabled = false;
                        btnSave.Click += new EventHandler(btnSave_Click);
                        toolTip2 = new RadToolTip();
                        toolTip2.TargetControlID = btnSave.ID;
                        toolTip2.Text = "Neue Eigenschaft im LifeCycleManagement speichern";
                    //Property Control hinzufügen
                return container;

    After a Postback on my Site the tooltips from the textboxes are gone away. The strange thing is, that the tooltip from the buttons (toolTip2 in the code) are still there and visible.

    Can you please have a look what is wrong there ?

    Thanks and kind regards

  4. Marin Bratanov
    Marin Bratanov avatar
    3908 posts

    Posted 09 Dec 2011 Link to this post

    Hello Christian,

    This logic seems to work fine on my end: I am also attaching my test page here so you can compare it with yours, as I had to comment out some of your custom functionality.

    Currently what I suspect might be happening is that when recreating the controls the IDs you supply after a postback are not the same as the original ones and there is a mismatch. Please debug your code and see if the controls are properly recreated.

    I can also suggest that you create these dynamic controls earlier - in the page_init event, as explained in the following article I recommend you examine carefully:

    Kind regards,
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
Back to Top