ASP.NET 中的两次回发

发布于 2024-07-25 01:45:53 字数 807 浏览 2 评论 0原文

我的页面完全回发两次。 我正在使用带有 AJAX 的母版页。 母版页的结构如下。

+---------------------------------------------+

|  Web User Control with AJAX Tab Control     |

+---------------------------------------------+

|        |                     |              |

| Col1   | ContentPlaceHolder  |   Col3       |

|        |                     |              |

|        |                     |              |

+---------------------------------------------+

Web 用户控件包含启用了 AutoPostback 的 AJAX 选项卡容器。

我使用这个母版页创建了几个 ASPX 页面。

内容占位符还可以根据页面获得 Web 用户控件。

每当我通过单击选项卡跳转到页面时,页面都会完全回发两次。 我不明白是什么原因。 这使得查看报告变得很麻烦,因为它需要双倍的时间。

请访问 - http://softwaregenius.net/ivnew4 了解想法。 我无法提供登录ID。

My page is fully postback twice. I am using master page with AJAX. The structure of master page is as follows.

+---------------------------------------------+

|  Web User Control with AJAX Tab Control     |

+---------------------------------------------+

|        |                     |              |

| Col1   | ContentPlaceHolder  |   Col3       |

|        |                     |              |

|        |                     |              |

+---------------------------------------------+

The web user control contains the AJAX Tab Container with AutoPostback on.

I have created several ASPX pages using this masterpage.

The content place holder also gets a web user control depending upon page.

Whenever I jump on a page by clicking on tab the page is fully postbacked twice. I dont understand whats the reason. That makes viewing reports cumbersome as it requires double time.

Please visit - http://softwaregenius.net/ivnew4 to get idea. I am not able to give loginid.

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

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

发布评论

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

评论(7

想念有你 2024-08-01 01:45:53

当 Page 指令 autoeventwireup 为 true 并且您将事件 OnInit 附加到 Page_Load 等事件时,这些事件将引发两次,使其看起来像双重回发。 也可能是别的东西。

When Page directive autoeventwireup is true and you attach an event OnInit to things like Page_Load, those events will be raised twice, making it look like double postback. It could be semething else, too.

百变从容 2024-08-01 01:45:53

我们可能需要更多信息,但您的更新面板是如何布局和配置的? 有更新面板吗?

如果您没有更新面板,则会发生自动回发,并且会回发整个页面。 如果控件被更新面板包围,则仅重新呈现更新面板。

We might need more information but how are you're Update panels laid out and configured? Do you have update panels?

If you don't have update panels, the auto post back will occur and it will post back the entire page. If the control is surrounded by an update panel, only the update panel is re-rendered.

掐死时间 2024-08-01 01:45:53

对我来说,双重回发往往会缺少资源或没有 src 的图像标签 - EG

<img src=""/>

Double post backs for me tend to be missing resources or image tags without a src - E.G.

<img src=""/>
杯别 2024-08-01 01:45:53

页面中是否有任何代码使您回发两次。
尝试使用方法 if(!page.ispostback){}
我认为这不是因为AJAX。

Is there any code in the page that make you postback twice.
Try the use the method if(!page.ispostback){}
I think it is not because of AJAX.

深巷少女 2024-08-01 01:45:53

我当时就处于这种情况,并且沮丧了很长一段时间。 我认为有人可能仍然觉得这很有用。 我的页面涉及大量自定义 ajax 调用(不是更新面板),并且当回发保存时(实现 request[".."] 样式而不是 control.value 样式 - 因为控件是通过 Ajax 动态创建的),回发发生了两次。 有 2 个解决方案,都很简单:

  1. 将 AutoEventWireup 设置为 false(这也会禁用一些已连接的自定义控件,例如数据绑定数据网格,就像我的情况)
  2. 对于那些需要 AutoEventWireup 为 true 的人,只需确保所有回发控件即可或按钮不是服务器控件,而是它们必须是标准 HTML 标记,并且不应具有 runat="server"。

就是这样!

I was in the exact situation and got frust for quite a while. Thought someone might still find this useful. My page involved a lot of custom ajax call (not update panel), and when post back for saving ( implementing request[".."] style not control.value style - cause the controls was create dynamically thru Ajax ), postback happened twice. There are 2 solutions and both are simple:

  1. Set AutoEventWireup to false (this will also disable some custom control that was wired up for instance databinded datagrid, like my case)
  2. for those who required AutoEventWireup to be true, just make sure all post back controls or buttons is not server control instead they must be standard HTML tags and should NOT have runat="server".

That's it!

心碎的声音 2024-08-01 01:45:53

我们遇到了同样的问题,这是由我们的 选项卡没有“src=”引起的
对于 Chrome 或 IE8 或更高版本来说,这一事实是正确的。

[Nos tivemos o mesmo problema e ele é causado pela falta dos src nos controles <img> e <asp:Imagem> . Isso ocrre apenas nos chrome ou no ie8 acima]

We had same problem it's caused by a tab <img> our <asp:Image> without "src="
This fact is true for Chrome or IE8 or above.

[Nos tivemos o mesmo problema e ele é causado pela falta dos src nos controles <img> e <asp:Imagem> . Isso ocrre apenas nos chrome ou no ie8 acima]
缺⑴份安定 2024-08-01 01:45:53

尝试这个解决方案,你只需要在脚本管理器之后复制粘贴一些JS

https://stackoverflow.com/a/22822756/1106625

try this solution you only need to copy paste some JS after your script manager

https://stackoverflow.com/a/22822756/1106625

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