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

Two RadTooltipManager on same page

3 Answers 87 Views
ToolTip
This is a migrated thread and some comments may be shown as answers.
jprian
Top achievements
Rank 1
jprian asked on 18 Jun 2013, 09:56 AM
Hi,

I've two radtooltipmanager is same page (RadToolTipManager1 and RadToolTipManager2)

<telerik:RadToolTipManager ID="RadToolTipManager1" runat="server" OnAjaxUpdate="RadToolTipManager1_AjaxUpdate"  RelativeTo="Element" ShowEvent="OnClick" ShowDelay="0" HideEvent="ManualClose" EnableDataCaching="false" EnableViewState="true">
</telerik:RadToolTipManager>
<telerik:RadToolTipManager ID="RadToolTipManager2" runat="server" OnAjaxUpdate="RadToolTipManager2_AjaxUpdate" RelativeTo="Element" ShowEvent="OnClick" ShowDelay="0" HideEvent="ManualClose" EnableDataCaching="false" EnableViewState="true">
</telerik:RadToolTipManager>


With RadToolTipManager1 I'm loading usercontrol ListaDocumentos.ascx and with RadToolTipManager2 I'm loading usercontrol ListaFichas.ascx.

Protected Sub RadToolTipManager1_AjaxUpdate(ByVal sender As Object, ByVal args As Telerik.Web.UI.ToolTipUpdateEventArgs)
    Me.UpdateToolTip1(args.Value, args.UpdatePanel)
End Sub
 
Protected Sub RadToolTipManager2_AjaxUpdate(ByVal sender As Object, ByVal args As Telerik.Web.UI.ToolTipUpdateEventArgs)
    Me.UpdateToolTip2(args.Value, args.UpdatePanel)
End Sub
 
Private Sub UpdateToolTip1(ByVal elementID As String, ByVal panel As UpdatePanel)
    Dim ctrl As UserControl = Me.LoadControl("ListaDocumentos.ascx")
    panel.ContentTemplateContainer.Controls.Add(ctrl)
    Dim detalles As CtrlWeb_ListaDocumentos = DirectCast(ctrl, CtrlWeb_ListaDocumentos)
    detalles.CodigoActivo = ddl_codactivo.SelectedValue
End Sub
 
Private Sub UpdateToolTip2(ByVal elementID As String, ByVal panel As UpdatePanel)
    Dim ctrl As UserControl = Me.LoadControl("ListaFichas.ascx")
    panel.ContentTemplateContainer.Controls.Add(ctrl)
    Dim detalles As CtrlWeb_ListaFichas = DirectCast(ctrl, CtrlWeb_ListaFichas)
    detalles.CodigoActivo = ddl_codactivo.SelectedValue
    detalles.FamiliaMorfologica = txt_fmorfologica.Text
End Sub


Usercontrols load is correct, each Tooltip shows his associated usercontrol.

ListaDocumentos.ascx has button. When I click on it RadToolTipManager1_AjaxUpdate is fired an then button click event. 
ListaFichas.ascx has RadListBox. When I click on it RadToolTipManager2_AjaxUpdate is fired an then SelectedIndexChanged event of radlistbox . 

It works ok, if I try individually.

But If I try RadToolTipManager1 first, button_click event is ok, then if I try RadToolTipManager2  after RadToolTipManager1, when I click on radlistbox item, I get RadToolTipManager1_AjaxUpdate event is fired, and then RadToolTipManager2_AjaxUpdate, but not SelectedIndexChanged event, so I must click twice on item to get SelectedIndexChanged event is fired.

I don't undestand why RadToolTipManager1_AjaxUpdate event is fired when it must be RadToolTipManager2_AjaxUpdate event.



Please, some help.

Thanks in advance

3 Answers, 1 is accepted

Sort by
0
Accepted
Ivaylo
Telerik team
answered on 21 Jun 2013, 08:32 AM
Hello,

Thank you for your contacting us.

Regarding your first question, we have created a sample project using the provided code and researched the issue. It seems that the cause for it are the different IDs that the server dynamically assigns to the user controls on each AJAX Request, which causes them to lose their ViewState. We highly recommend explicitly setting those IDs in order to avoid problems such as the one experienced. For this reason, I would suggest the following modification:
Private Sub UpdateToolTip1(ByVal elementID As String, ByVal panel As UpdatePanel)
    Dim ctrl As UserControl = Me.LoadControl("ListaDocumentos.ascx")
    ctrl.ID = "ListaDocumentosUC"
    panel.ContentTemplateContainer.Controls.Add(ctrl)
    Dim detalles As CtrlWeb_ListaDocumentos = DirectCast(ctrl, CtrlWeb_ListaDocumentos)
    detalles.CodigoActivo = ddl_codactivo.SelectedValue
End Sub
 
Private Sub UpdateToolTip2(ByVal elementID As String, ByVal panel As UpdatePanel)
    Dim ctrl As UserControl = Me.LoadControl("ListaFichas.ascx")
    panel.ContentTemplateContainer.Controls.Add(ctrl)
    ctrl.ID = "ListaFichasUC"
    Dim detalles As CtrlWeb_ListaFichas = DirectCast(ctrl, CtrlWeb_ListaFichas)
    detalles.CodigoActivo = ddl_codactivo.SelectedValue
    detalles.FamiliaMorfologica = txt_fmorfologica.Text
End Sub

For your convenience, I have attached a sample project based on the provided code, illustrating the described changes.

As for your second inquiry, regarding the sequence in which AjaxUpdate events are fired, this is the normally expected behavior when working with the Tooltip manager. The intention behind this is to ensure that all user controls in the displayed tooltips are properly loaded since we cannot be sure what has caused the partial postback to the server and that those controls are not already disposed of. Without this safety procedure, the user might be interacting with controls, which are no longer registered on the server, causing undesired behavior.

I hope that you will find the provided information helpful. Should you have any other questions, feel free to contact us.

Regards,
Ivaylo
Telerik
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 the blog feed now.
0
jprian
Top achievements
Rank 1
answered on 21 Jun 2013, 09:48 AM
Hi Ivaylo, thank you very much.
It do the trick.
And thank you for your sample project

Perfect!!

Best regards
0
Joel R
Top achievements
Rank 1
answered on 17 Jan 2014, 06:50 PM
this solved my problem... THANKS
Tags
ToolTip
Asked by
jprian
Top achievements
Rank 1
Answers by
Ivaylo
Telerik team
jprian
Top achievements
Rank 1
Joel R
Top achievements
Rank 1
Share this question
or