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

Tooltip Not Updating?

1 Answer 63 Views
ToolTip
This is a migrated thread and some comments may be shown as answers.
Landon Martin
Top achievements
Rank 1
Landon Martin asked on 17 Nov 2009, 11:46 PM
I have a tooltip manager on my page that has 2 dropdowns and a textbox on it.  When the user clicks an edit button I display the tooltip and load the controls.  This works great the first time the button is clicked. However if the user closes the tooltip and clicks a second edit button on the page the tooltip shows with the information from the original item.  I have stepped through the code and it shows that the values of the controls are being set correctly all the way throughout.  However it doesn't seem that the actual controls are being updated on the page.  I would appreciate any help anyone could provide.

        protected void OnAjaxUpdate(object sender, ToolTipUpdateEventArgs args)  
        {  
           
            string[] values = args.Value.Split('|');  
            if (values.Length > 0)  
            {  
                this.UpdateToolTip(values[0], args.UpdatePanel, int.Parse(values[1]));  
            }              
        }  
 
        private void UpdateToolTip(string section, UpdatePanel update, int index)  
        {              
            ToolTipContent ctl = (ToolTipContent)Page.LoadControl("tooltipcontent/" + section + ".ascx");              
            ctl.SetIndex(index); //This sets the values of the controls  
            update.ContentTemplateContainer.Controls.Add(ctl);           
            //At this point (and after) the controls look like they are set correctly in the code   
            //it is only when the tooltip is loaded that it shows incorrectly.  
        } 

1 Answer, 1 is accepted

Sort by
0
Landon Martin
Top achievements
Rank 1
answered on 18 Nov 2009, 12:29 AM
Ugh. I need to not give up so easily.
I changed my UserControl code... before in SetIndex I was updating the controls.  What I changed it to is I store the information and then in the user control's PreRender event THEN I actually set the control values.  It works fine now.  Thanks anyway!
Tags
ToolTip
Asked by
Landon Martin
Top achievements
Rank 1
Answers by
Landon Martin
Top achievements
Rank 1
Share this question
or