从 JavaScript 调用多个 __doPostBack

发布于 2024-07-10 08:34:52 字数 180 浏览 5 评论 0原文

我在一个页面上有多个 UpdatePanel,并且我通过调用 __doPostBack 手动更新其中 2 个。 然而问题是,当第二次调用时,第一个调用似乎被重置(它永远不会更新我要求首先更新的面板)。 我已经将这些调用封装在 setTimeout 中,但它似乎没有帮助。

关于如何使这两个通话正常工作有什么建议吗?

I've got multiple UpdatePanel's on a page and i'm updating 2 of them manually by calling __doPostBack.
However the problem is the first call seems to be reset when the second call is made (it never updates the panel that i requested to update first).
I've got these calls wrapped in setTimeout, but it does not seem to help.

Any suggestions on how to make both calls work?

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

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

发布评论

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

评论(1

穿越时光隧道 2024-07-17 08:34:52

您可以在服务器端执行此操作:

UpdatePanel1.Update();
UpdatePanel2.Update();

这会导致提交的返回包含两个面板的更新信息,而不是一次只包含一个面板。 我认为更新面板需要设置为有条件更新。

另外,还有一个问题,你有在更新面板中调用setTimeout的脚本吗? 或者是在其他地方,这可能是罪魁祸首,但我不知道这一点。

You could probably do this on the server side of things:

UpdatePanel1.Update();
UpdatePanel2.Update();

This causes the return from the submission to contain updated information for both panels, instead of just one at a time. I believe the update panels need to be set for conditional updates however.

Also, another question, do you have the script that calls setTimeout inside the update panel? Or is it elsewhere, that may be the culprit, however I do not know off the top of my head on that one.

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