看来 JQuery 和 AjaxToolkit 不能一起工作

发布于 2024-11-30 18:37:26 字数 2632 浏览 1 评论 0原文

我使用 JQuery 创建了一个很好的工具提示框,并且使用了一些在所有浏览器中都运行良好的插件。但是当我将组件放入更新面板时,问题就开始了,我通过显示一些代码来解释这一点:

 <asp:UpdatePanel ID="UpdatePanel1" runat="server">
                            <ContentTemplate>
                                <asp:UpdateProgress ID="UpdateProgress0" runat="server">
                                    <ProgressTemplate>
                                        <div style="width: 100%;">
                                            <p>
                                                Please Wait, It is loading...
                                            </p>
                                        </div>
                                    </ProgressTemplate>
                                </asp:UpdateProgress>
                                <table class="style1">
                                    <tr>
                                        <td align="center">
                                            <asp:Button ID="btnUpBestSale" runat="server" OnClick="btnUpBestSale_Click" Text="▲" />
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            <div id="demo">
                                                <uc6:GroupLoader ID="GroupLoader1" runat="server" GroupCode="37" ItemCount="5" ItemCountSkipness="0"
                                                    RepeatedColumns="1" TypeID="Vertical" />
                                            </div>
                                            <script>
                                                $("#demo img[title]").tooltip({ offset: [30, 25] });
                                            </script>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td align="center">
                                            <asp:Button ID="btnDownBestSale" runat="server" OnClick="btnDownBestSale_Click" Text="▼" />
                                        </td>
                                    </tr>
                                </table>
                            </ContentTemplate>
                        </asp:UpdatePanel>

当我单击按钮和组加载器组件内的行数据绑定事件时,更新面板是必要的。

它第一次工作,但单击更新面板内的按钮后,jquery 事件再也不会出现。

我该如何解决这个问题?

I have created a nice tooltip box using JQuery and I used some plugin which are works very well in all browser. but the problem is started when I put my component in an update-panel I explain this by show some code :

 <asp:UpdatePanel ID="UpdatePanel1" runat="server">
                            <ContentTemplate>
                                <asp:UpdateProgress ID="UpdateProgress0" runat="server">
                                    <ProgressTemplate>
                                        <div style="width: 100%;">
                                            <p>
                                                Please Wait, It is loading...
                                            </p>
                                        </div>
                                    </ProgressTemplate>
                                </asp:UpdateProgress>
                                <table class="style1">
                                    <tr>
                                        <td align="center">
                                            <asp:Button ID="btnUpBestSale" runat="server" OnClick="btnUpBestSale_Click" Text="▲" />
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            <div id="demo">
                                                <uc6:GroupLoader ID="GroupLoader1" runat="server" GroupCode="37" ItemCount="5" ItemCountSkipness="0"
                                                    RepeatedColumns="1" TypeID="Vertical" />
                                            </div>
                                            <script>
                                                $("#demo img[title]").tooltip({ offset: [30, 25] });
                                            </script>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td align="center">
                                            <asp:Button ID="btnDownBestSale" runat="server" OnClick="btnDownBestSale_Click" Text="▼" />
                                        </td>
                                    </tr>
                                </table>
                            </ContentTemplate>
                        </asp:UpdatePanel>

The Update panel is necessary when I click on the button and on row data-bind event that is inside my grouploader component.

it work at the first time but after clicking on the button that is inside the update panel jquery event never rise again.

How I can solve this ?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

陪你搞怪i 2024-12-07 18:37:26

请尝试使用此代码。它将确保在 UpdatePanel 中的所有内容更新后执行脚本。 (参考:http://msdn.microsoft.com/en-us/library/ bb383810.aspx)

<script>
      var prm = Sys.WebForms.PageRequestManager.getInstance();
      prm.add_endRequest(function() {
          $("#demo img[title]").tooltip({ offset: [30, 25] });
      });
</script>

<asp:UpdatePanel ID="UpdatePanel1" runat="server">
                            <ContentTemplate>
                                <asp:UpdateProgress ID="UpdateProgress0" runat="server">
                                    <ProgressTemplate>
                                        <div style="width: 100%;">
                                            <p>
                                                Please Wait, It is loading...
                                            </p>
                                        </div>
                                    </ProgressTemplate>
                                </asp:UpdateProgress>
                                <table class="style1">
                                    <tr>
                                        <td align="center">
                                            <asp:Button ID="btnUpBestSale" runat="server" OnClick="btnUpBestSale_Click" Text="▲" />
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            <div id="demo">
                                                <uc6:GroupLoader ID="GroupLoader1" runat="server" GroupCode="37" ItemCount="5" ItemCountSkipness="0"
                                                    RepeatedColumns="1" TypeID="Vertical" />
                                            </div>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td align="center">
                                            <asp:Button ID="btnDownBestSale" runat="server" OnClick="btnDownBestSale_Click" Text="▼" />
                                        </td>
                                    </tr>
                                </table>
                            </ContentTemplate>
                        </asp:UpdatePanel>

Try this code instead. It will make sure that the script will be executed after everything in UpdatePanel is updated. (Reference: http://msdn.microsoft.com/en-us/library/bb383810.aspx)

<script>
      var prm = Sys.WebForms.PageRequestManager.getInstance();
      prm.add_endRequest(function() {
          $("#demo img[title]").tooltip({ offset: [30, 25] });
      });
</script>

<asp:UpdatePanel ID="UpdatePanel1" runat="server">
                            <ContentTemplate>
                                <asp:UpdateProgress ID="UpdateProgress0" runat="server">
                                    <ProgressTemplate>
                                        <div style="width: 100%;">
                                            <p>
                                                Please Wait, It is loading...
                                            </p>
                                        </div>
                                    </ProgressTemplate>
                                </asp:UpdateProgress>
                                <table class="style1">
                                    <tr>
                                        <td align="center">
                                            <asp:Button ID="btnUpBestSale" runat="server" OnClick="btnUpBestSale_Click" Text="▲" />
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            <div id="demo">
                                                <uc6:GroupLoader ID="GroupLoader1" runat="server" GroupCode="37" ItemCount="5" ItemCountSkipness="0"
                                                    RepeatedColumns="1" TypeID="Vertical" />
                                            </div>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td align="center">
                                            <asp:Button ID="btnDownBestSale" runat="server" OnClick="btnDownBestSale_Click" Text="▼" />
                                        </td>
                                    </tr>
                                </table>
                            </ContentTemplate>
                        </asp:UpdatePanel>
韬韬不绝 2024-12-07 18:37:26

从更新面板异步回发后,jquery 将无法工作。因此您必须使用 endrequesthandler,
以下是具体操作方法。
http://codethatworkedforme.blogspot.com/2011/08 /having-issues-with-update-panel.html

jquery wont work after async postback from update panel.so you will have to use endrequesthandler,
Here's how to do it.
http://codethatworkedforme.blogspot.com/2011/08/having-issues-with-update-panel.html

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文