Search code examples
jqueryasp.netupdatepanelajaxcontroltoolkit

jquery ui tooltip remains visible for the controls under ajax update panel


Snapshot of the issue![Snapshot of the problem][2] I have a web form that uses two update panels in the following code below:

<asp:UpdatePanel ID="UpdatePanel2" runat="server">
                <ContentTemplate>
                    <div id="SpeciesWrapper" class="RowControl" runat="server">
                        <div class="QuestionColumnControl">
                            <asp:Label ID="lblspecies" runat="server">[$BRAND(LABEL,STAGE1.SPECIES)$]</asp:Label>
                        </div>
                        <div class="AnswerColumnControl" title="Please let us know the type of pet you want to insure.">
                            <asp:RadioButtonList ID="radbtnspecies" runat="server" AutoPostBack="True" OnSelectedIndexChanged="speciesChanged"
                                RepeatDirection="Horizontal" >
                                <asp:ListItem Text="Cat" />
                                <asp:ListItem Text="Dog" />
                            </asp:RadioButtonList>
                            <label for="radbtnspecies" class="error">
                                Please select your gender</label>
                            <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ErrorMessage="Select your Species Type"
                                ControlToValidate="radbtnspecies" EnableClientScript="False"></asp:RequiredFieldValidator>


                        </div>
                    </div>
                    <div id="PetBreedWrapper" class="RowControl" runat="server">
                        <div class="QuestionColumnControl">
                            <asp:Label ID="lblPetBreed" runat="server" AssociatedControlID="ddlPetBreed">[$BRAND(LABEL,STAGE1.PETBREED)$]</asp:Label>
                        </div>
                        <div class="AnswerColumnControl">
                            <asp:DropDownList ID="ddlPetBreed" runat="server" ToolTip="If you can’t find the right breed, please call us as we may still be able to insure your pet." />
                            <span class="errormsg">
                                <cc1:BDML_HighlighterValidator ID="valPetBreed" runat="server" ControlToValidate="ddlPetBreed"
                                    DivID="PetBreedWrapper" DivCSS="RowControl" ErrorClass="RowControlErr" ForeColor=""
                                    ValidateEmptyText="True" ErrorMessage="[$BRAND(ERROR,STAGE1.PETBREED.REQ)$]"
                                    Display="Dynamic" OnServerValidate="required_ServerValidate" SetFocusOnError="true"> </cc1:BDML_HighlighterValidator>
                            </span>
                        </div>
                    </div>
                </ContentTemplate>
                <Triggers>
                    <asp:AsyncPostBackTrigger ControlID="radbtnspecies" EventName="SelectedIndexChanged" />
                </Triggers>
            </asp:UpdatePanel>

The other piece of form which uses update panel is here:

<asp:UpdatePanel ID="UpdatePanel1" runat="server">
                <ContentTemplate>
                    <div id="ChippedWrapper" class="RowControl" runat="server">
                        <div class="QuestionColumnControl">
                            <asp:Label ID="lblChipped" runat="server" AssociatedControlID="radChippedYes">[$BRAND(LABEL,STAGE1.CHIPPED)$]</asp:Label>
                        </div>
                        <div class="AnswerColumnControl" title="Has your pet been identified with a chip or tag?">
                            <asp:RadioButton ID="radChippedYes" Checked="true" runat="server" GroupName="radChipped"
                                AutoPostBack="True" OnCheckedChanged="radChippedYes_CheckedChanged" />
                            <asp:Label ID="lblChippedYes" runat="server" AssociatedControlID="radChippedYes">[$BRAND(LABEL,STAGE1.CHIPPEDYES)$]</asp:Label>
                            <asp:RadioButton ID="radChippedNo" runat="server" GroupName="radChipped" AutoPostBack="True"
                                OnCheckedChanged="radChippedNo_CheckedChanged" />
                            <asp:Label ID="lblChippedNo" runat="server" AssociatedControlID="radChippedNo">[$BRAND(LABEL,STAGE1.CHIPPEDNO)$]</asp:Label>
                            <%--<img alt="Help" class="help" src="[$BRAND(IMAGELINK,HELP)$]" onmouseover="javascript:showhelpdiv('help-chipped')"
                                onmouseout="javascript:hidehelpdiv('help-chipped')" onmousemove="javascript:movehelpdiv(event,'help-chipped')" />--%>
                        </div>
                    </div>
                    <div id="ChipNoWrapper" class="RowControl" runat="server">
                        <div class="QuestionColumnControl">
                            <asp:Label ID="lblChipNo" runat="server" AssociatedControlID="txtChipNo">[$BRAND(LABEL,STAGE1.CHIPNO)$]</asp:Label>
                        </div>
                        <div class="AnswerColumnControl">
                            <asp:TextBox ID="txtChipNo" runat="server" MaxLength="15" />
                            <%--<img alt="Help" class="help" src="[$BRAND(IMAGELINK,HELP)$]" onmouseover="javascript:showhelpdiv('help-chipno')"
                                onmouseout="javascript:hidehelpdiv('help-chipno')" onmousemove="javascript:movehelpdiv(event,'help-chipno')" />--%>
                            <span class="errormsg">

                            </span>
                        </div>
                    </div>
                </ContentTemplate>
                <Triggers>
                    <asp:AsyncPostBackTrigger ControlID="radChippedYes" EventName="CheckedChanged" />
                </Triggers>
            </asp:UpdatePanel>

I am using external script file and referencing it on the page. Form uses jquery ui tooltip widget on the page load with following code:

if ($('body').prop('id') == "youandyourpet") {

$(function () {


    //code to initialize tooltip
    $(document).tooltip();
 });

function pageLoad(sender, args) {

        //code to initialize tooltip
        $(document).tooltip();      
}}

Here I am using jquery ready function as well as pageLoad function so that when the update panel's partial rendering takes place, it again ties the controls with tooltip. But I have checked in IE7,8 and latest chrome version that the tooltip remains visible if any of the above radio button are selected which are in the control panel.

![image to show the form problem][3]


Solution

  • I have searched a lot on many forums. Also, I am doing correctly but finally I have a very dirty way to solve my issue.

    var prm = Sys.WebForms.PageRequestManager.getInstance(); prm.add_endRequest(function () { $(".ui-tooltip-content").parents('div').remove(); });

    Please provide any other solution if anyone is aware of. Cheers.