ASP.Net UpdatePanel 导致 Dojo 按钮丢失 Dojo 属性

发布于 2024-08-30 17:39:16 字数 747 浏览 2 评论 0原文

我有一个包含 ASP UpdatePanel 的页面,在 UpdatePanel 中,有一个使用 Dojo 设计样式的按钮,其 dojoType 为 dijit.form.Button。

当 UpdatePanel 更新时,按钮会丢失所有 CSS 样式,因此它会恢复为普通的 html 按钮。

我推测这是因为 dojo 方法不会在部分页面回发时被调用,导致按钮被服务器重绘并发布到页面,并且 dojo 没有被告知任何这些情况。

此外,更新后“dojo/method”脚本不再与按钮关联。

这是按钮:

<button id="btnShowMessages" dojoType="dijit.form.Button" type="button">
    Show failure messages
    <script type="dojo/method" event="onClick" args="evt">
        dijit.byId("dlgFailedMessages").show();
    </script>
</button>

它包含在标准 ASP UpdatePanel 中,并带有导致更新的 ASP LinkBut​​ton(也位于 UpdatePanel 内,因此标记中不需要任何内容​​)。

有没有办法让dojo知道部分页面更新?这样按钮就可以保持其样式,并且 dojo 仍然能够将方法附加到按钮。

I have a page which contains an ASP UpdatePanel, and within the UpdatePanel, there is a button styled using Dojo with a dojoType of dijit.form.Button.

When the UpdatePanel updates, the button loses all of the CSS styling, so it reverts back to an ordinary looking html button.

I'm presuming this is because the dojo methods don't get called on a partial page postback, causing the button to get redrawn by the server and posted to the page, and dojo not being told about any of this.

Also, the "dojo/method" script is no longer associated with the button after the update.

This is the button:

<button id="btnShowMessages" dojoType="dijit.form.Button" type="button">
    Show failure messages
    <script type="dojo/method" event="onClick" args="evt">
        dijit.byId("dlgFailedMessages").show();
    </script>
</button>

This is wrapped in a standard ASP UpdatePanel with an ASP LinkButton causing the update (also located within the UpdatePanel, so nothing is required in the <Triggers> tag).

Is there any way of making dojo aware of the partial page update? So that the button keeps it's style and dojo is still able to attach the method to the button.

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

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文