Firefox 和更新面板

发布于 2024-07-23 15:30:00 字数 989 浏览 8 评论 0原文

我在使用 FireFox 和 ASP.NET UpdatePanel 时遇到问题。 我在表单中有一个复选框和一个 UpdatePanel。 当我选中该复选框时,UpdatePanel 中的 asp:panel 应该变得可见。

<asp:CheckBox ID="cbMoreOptions" runat="server" Text="plus d'options" AutoPostBack="True" OnCheckedChanged="cbOptions_CheckedChanged" /> 

<asp:UpdatePanel ID="UpdatePanel1" runat="server">
  <ContentTemplate>
    <asp:Panel ID="Panel1" runat="server" Visible="false"> 
       sssssssss
    </asp:Panel>
  </ContentTemplate>
  <Triggers>
    <asp:AsyncPostBackTrigger ControlID="cbMoreOptions" EventName="CheckedChanged" /> 
  </Triggers>
</asp:UpdatePanel> 

一切工作正常,但在选中复选框时刷新页面后就不行了。 如果发生这种情况,则选中该页面的复选框不会向服务器进行更多回发。 Firebug 显示页面得到响应,当我验证其内容时,出现错误 500,表明该页面的信息已损坏。 这一切只发生在 Firefox 中。 在 IE8 和 Google Chrome 中一切正常。

有人知道我该如何避免这种情况吗? 这是火狐浏览器的一个bug吗? 所有奇怪的行为都会继续,直到我在 URL 文本框中输入内容。 即使我按F5也没有任何反应。 F5 和输入 URL 有什么区别? 他们不应该得到相同的结果吗?

多谢。

I have a problem with FireFox and ASP.NET UpdatePanel.
I have in a form a checkbox and an UpdatePanel. When I check the checkbox, an asp:panel which is into the UpdatePanel should become visible.

<asp:CheckBox ID="cbMoreOptions" runat="server" Text="plus d'options" AutoPostBack="True" OnCheckedChanged="cbOptions_CheckedChanged" /> 

<asp:UpdatePanel ID="UpdatePanel1" runat="server">
  <ContentTemplate>
    <asp:Panel ID="Panel1" runat="server" Visible="false"> 
       sssssssss
    </asp:Panel>
  </ContentTemplate>
  <Triggers>
    <asp:AsyncPostBackTrigger ControlID="cbMoreOptions" EventName="CheckedChanged" /> 
  </Triggers>
</asp:UpdatePanel> 

Everything is working fine but not after I refresh the page while the checkbox is checked. If this is happening, the checkbox rest checked the page doesn’t make postback more to the server. The firebug shows that the page gets a response and when I verify the its content I have en error 500 which tell that the information of the page is corrupt. All this is happening only in Firefox. In IE8 and Google Chrome everything is ok.

Does anybody have an idea how can I avoid this? It’s a bug of Firefox?
All the weird comportment continues until I make enter into the URL textbox. Even if I make F5 nothing happens. What is the difference between F5 and enter into the URL? They shouldn’t have the same result?

Thanks a lot.

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

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

发布评论

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

评论(3

秋叶绚丽 2024-07-30 15:30:00

您是否尝试过将复选框“cbMoreOptions”放入 UpdatePanel 中?

放置在 UpdatePanel ContentTemplate 部分内并为 CheckBox 设置 AsyncPostBackTrigger。

Have you tried placing the checkbox "cbMoreOptions" inside the UpdatePanel?

Place in inside the UpdatePanel ContentTemplate section and set an AsyncPostBackTrigger for the CheckBox.

不一样的天空 2024-07-30 15:30:00

我们很久以前就遇到过这个问题,这是 Firefox 使用内存缓存来存储页面状态的方式,这扰乱了 ASP.NET 处理 VIEWSTATE 隐藏字段的方式。 检查您的 aspx 页面是否启用了缓存并将其禁用。

编辑:这是一个链接,解释了详细地讲一下。

We had this problem a long time ago and it was the way firefox uses in-memory cache to store the state of a page which messes up the way ASP.NET handles VIEWSTATE hidden field. Check if caching turned on for your aspx pages and disable it.

Edit: Here's a link that explains it in detail.

大海や 2024-07-30 15:30:00

F5 和输入 URL 有什么区别? 他们
不应该有相同的结果吗?

如果您在地址栏中按 Enter 键,它会执行 GET 请求,即您使用 !IsPostBack 输入页面的生命周期。
当您按 F5 时,我观察到 Firefox 将重复最后一个请求,因此如果最后一个请求是 POST,它将重复它。 这就是为什么您的页面处于有错误的状态。 如果第一次回发导致错误(复选框“checkedChanged”),按 F5 将重复该错误。

所以,,它们没有相同的结果。

我没有任何文档来支持这一说法,但这是我观察到的。 如果有人能指出来源,我会很高兴看到它。

What is the difference between F5 and enter into the URL? They
shouldn’t have the same result?

If you hit enter in the address bar, it does a GET request, i.e. you enter your page's lifecycle with !IsPostBack.
When you hit F5, I observed that firefox will repeat the last request, so if that last request was a POST, it will repeat it. That's why your page stay in a buggy state. If the first post back caused an error (the checkbox' checkedChanged), hitting F5 will just repeat that error.

So, no, the don't have the same result.

I don't have any documentation to backup this statement, but this is what I observed. If anyone can point a source I'll be glad to see it.

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