Help with tooltip problem after Listbox transfers

2 posts, 0 answers
  1. Chris
    Chris avatar
    8 posts
    Member since:
    May 2009

    Posted 14 Jan 2010 Link to this post

    I have a form with 2 listboxes configured to support transfers between the 2.  I have written code to dynamically (load on demand) display tooltips on the listbox items.

    This works great up until the point that an item is transferred from 1 listbox to the other listbox.  After this happens, any time the user hovers over a listitem an error is thrown with this message: "Cannot find a server control with ID=i173. If you need to specify a client-side element ID, please set IsClientID to true."  What's odd is that the server control id in the error message is NOT the one that I'm hovering over in the UI.  

    The stacktrace for the error doesn't mention any line of my code, it's all in the telerik code so I'm not really sure what the cause of the problem is.

    Stack Trace:

       at Telerik.Web.UI.RadToolTipBase.ThrowControlNotFound(String ctrlID) 
       at Telerik.Web.UI.RadToolTipManager.DescribeComponent(IScriptDescriptor descriptor) 
       at Telerik.Web.UI.RadWebControl.Telerik.Web.IControl.DescribeComponent(IScriptDescriptor descriptor) 
       at Telerik.Web.UI.ScriptRegistrar.GetScriptDescriptors(Control control) 
       at Telerik.Web.UI.ScriptRegistrar.GetScriptDescriptors(WebControl control) 
       at Telerik.Web.UI.RadWebControl.GetScriptDescriptors() 
       at Telerik.Web.UI.RadWebControl.System.Web.UI.IScriptControl.GetScriptDescriptors() 
       at System.Web.UI.ScriptControlManager.RegisterScriptDescriptors(IScriptControl scriptControl) 
       at System.Web.UI.ScriptManager.RegisterScriptDescriptors(IScriptControl scriptControl) 
       at Telerik.Web.UI.RadWebControl.RegisterScriptDescriptors() 
       at Telerik.Web.UI.RadWebControl.Render(HtmlTextWriter writer) 
       at System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) 
       at System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) 
       at System.Web.UI.Control.RenderControl(HtmlTextWriter writer) 
       at System.Web.UI.PageRequestManager.RenderFormCallback(HtmlTextWriter writer, Control containerControl) 
       at System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) 
       at System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) 
       at System.Web.UI.HtmlControls.HtmlForm.RenderChildren(HtmlTextWriter writer) 
       at System.Web.UI.HtmlControls.HtmlContainerControl.Render(HtmlTextWriter writer) 
       at System.Web.UI.HtmlControls.HtmlForm.Render(HtmlTextWriter output) 
       at System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) 
       at System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) 
       at System.Web.UI.HtmlControls.HtmlForm.RenderControl(HtmlTextWriter writer) 
       at System.Web.UI.HtmlFormWrapper.System.Web.UI.IHtmlForm.RenderControl(HtmlTextWriter writer) 
       at System.Web.UI.PageRequestManager.RenderPageCallback(HtmlTextWriter writer, Control pageControl) 
       at System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) 
       at System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) 
       at System.Web.UI.Page.Render(HtmlTextWriter writer) 
       at Telerik.Web.UI.RadAjaxPage.Render(HtmlTextWriter writer) 
       at System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) 
       at System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) 
       at System.Web.UI.Control.RenderControl(HtmlTextWriter writer) 
       at Telerik.Web.UI.RadAjaxControl.RenderPageInAjaxMode(HtmlTextWriter writer, Control page) 
       at System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) 
       at System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) 
       at System.Web.UI.Page.Render(HtmlTextWriter writer) 
       at Telerik.Web.UI.RadAjaxPage.Render(HtmlTextWriter writer) 
       at System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) 
       at System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) 
       at System.Web.UI.Control.RenderControl(HtmlTextWriter writer) 
       at Telerik.Web.UI.RadAjaxControl.RenderPageInAjaxMode(HtmlTextWriter writer, Control page) 
       at System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) 
       at System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) 
       at System.Web.UI.Page.Render(HtmlTextWriter writer) 
       at Telerik.Web.UI.RadAjaxPage.Render(HtmlTextWriter writer) 
       at System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) 
       at System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) 
       at System.Web.UI.Control.RenderControl(HtmlTextWriter writer) 
       at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) 


    Here is the listbox definition:

                    <table > 
                        <tr> 
                            <td><telerik:RadListBox ID="PolicyList" runat="server" TransferMode="Move" ButtonSettings-Position="Right" Width="350px" Height="200px" 
                                SelectionMode="Multiple" AllowTransfer="true" TransferToID="SelectedPolicyList" EnableDragAndDrop="true" 
                                DataKeyField="Id" DataTextField="Title" DataValueField="Id" 
                                OnItemDataBound="PoliciesDataBound"                             
                                ><ButtonSettings AreaWidth="30px" Position="Right"  /> 
                                </telerik:RadListBox> 
                            </td> 
                            <td> 
                                <telerik:RadListBox ID="SelectedPolicyList" runat="server" Width="350px" Height="200px" 
                                SelectionMode="Multiple" EnableDragAndDrop="true"  
                                DataKeyField="Id" DataTextField="Title" DataValueField="Id" 
                                OnItemDataBound="SelectedPoliciesDataBound"                             
                                ></telerik:RadListBox> 
                            </td> 
                        </tr> 
                    </table> 
     

    Here is the Data bound event handler:

            protected void PoliciesDataBound(object sender, RadListBoxItemEventArgs e) 
            { 
                RadToolTipManager1.TargetControls.Add(e.Item.ID); 
            } 
     
            protected void SelectedPoliciesDataBound(object sender, RadListBoxItemEventArgs e) 
            { 
                RadToolTipManager1.TargetControls.Add(e.Item.ID); 
            } 
     

    Here is the Ajax Event handler:

            protected void RadToolTipManager1_AjaxUpdate(object sender, Telerik.Web.UI.ToolTipUpdateEventArgs e) 
            { 
                if (e.TargetControlID != null && e.TargetControlID != ""
                { 
                    RadListBoxItem item = (RadListBoxItem)PolicyList.FindControl(e.TargetControlID); 
                    if (item == null
                        item = (RadListBoxItem)SelectedPolicyList.FindControl(e.TargetControlID); 
     
                    if (item != null
                    { 
                        PolicyDAO dao = new PolicyDAO(_domain); 
                        Policy pol = dao.Get(_session, Int32.Parse(item.Value)); 
                        HtmlGenericControl htmlGenericControl = new HtmlGenericControl("div"); 
                        htmlGenericControl.InnerHtml = pol.PolicyText; 
                        e.UpdatePanel.ContentTemplateContainer.Controls.Add(htmlGenericControl); 
                        
                    } 
                } 
            } 
     

  2. Chris
    Chris avatar
    8 posts
    Member since:
    May 2009

    Posted 16 Jan 2010 Link to this post

    For anyone that runs into this problem I figured out what I was doing wrong.  You need to implement the OnTransferred server event.  In the event handler clear all of the tooltips from the RadToolTipManager.  Then you can iterate over the listboxes and add the target controls back into the handler.
Back to Top