ASP.NET UpdatePanel 抛出“无效回发” 中继器按钮例外

发布于 2024-07-25 11:28:36 字数 161 浏览 1 评论 0原文

我在 UpdatePanel 内有一个简单的中继器,其中包含一个标签和两个图像按钮。 OnClick 属性是在设计时在每个按钮的属性中设置的。 当我单击任一按钮时,我收到“无效的回发或回调参数。事件验证已启用......”。 我在其他网络应用程序中做了完全相同的事情,但我似乎无法弄清楚这里发生了什么。

I have a simple repeater inside of an UpdatePanel that contains a label and two image buttons. The OnClick property is set in the attributes of each button at design time. When I click either of the buttons, I recieve the "Invalid postback or callback argument. Event validation is enabled........". I have done the exact same thing in other web applications but I cant seem to figure out whats going on here.

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

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

发布评论

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

评论(2

战皆罪 2024-08-01 11:28:36

我的猜测是,您的内容在服务器最初呈现后正在发生变化。 当一个值被发回服务器时(例如,选定的项目值),该值未在原始响应中呈现,因此不在视图状态中,则会引发此错误。

针对您的情况的简单解决方法是简单地在 web.config 或 @page 指令中关闭事件验证。

My guess is that your content is changing after it is initially rendered by the server. This error is thrown when a value is posted back to the server (like a selected item value, for example) which was not rendered out in the original response, and is therefore not in viewstate.

The easy fix for your situation is to simply turn off event validation in either the web.config or the @page directive.

幻梦 2024-08-01 11:28:36

设置 EnableEventValidation="false" 当然是一个简单的修复方法,但我不推荐这样做,特别是在 web.config 级别。

如果可能的话,请使用 ClientScript.RegisterForEventValidation 代替。

本页通过示例解释了这两种方法:
http://odetocode.com/Blogs/scott/archive/2006/03/22/asp-net-event-validation-and-invalid-callback-or-postback-argument-again.aspx< /a>

Setting EnableEventValidation="false" is certainly an easy fix but I wouldn't recommend it, particularly not at the web.config level.

If at all possible, use ClientScript.RegisterForEventValidation instead.

This page explains both methods, with examples:
http://odetocode.com/Blogs/scott/archive/2006/03/22/asp-net-event-validation-and-invalid-callback-or-postback-argument-again.aspx

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