UpdatePanel 带有“无效的回发或回调参数”错误
我在 ASP.NET 2.0 中有一个 .ascx 服务器控件,其中包含其他几个 .ascx 服务器控件。顶层的所有内容都包含在 UpdatePanel 中。它工作得很好,直到我第二次在页面上执行某些操作,然后我在警报对话框中收到此错误:
回发或回调参数无效。使用配置或 <%@ Page EnableEventValidation="true" %> 启用事件验证在一个页面中。出于安全目的,此功能验证回发或回调事件的参数是否源自最初呈现它们的服务器控件。如果数据有效且符合预期,请使用 ClientScriptManager.RegisterForEventValidation 方法注册回发或回调数据以进行验证。
这似乎是一个常见的错误;一个 < 一个href="http://www.google.com/search?q=%22invalid+postback+or+callback+argument%22&ie=utf-8&oe=utf-8&aq=t& rls=org.mozilla%3aen-US%3aofficial&client=firefox-a#sclient=psy&hl=en&client=firefox-a&hs=MxZ&rls=org.mozilla%3aen-US%3aofficial&client=firefox-a#sclient=psy&hl=en&client=firefox-a&hs=MxZ& ;rls=org.mozilla%3aen-US%3Aofficial&source=hp&q=%22invalid+postback+or+callback+argument%22+updatepanel& aq=f&aqi=&aql=&oq=&pbx=1&bav=on.2,or.r_gc.r_pw.&fp=1ec92a21f3882047&biw=1280&bih=874" rel="nofollow">Google 搜索 会显示多个结果。他们似乎都说,如果发生回发,您必须确保在包含已更新控件的任何 UpdatePanel 上调用 Update。但是当我调试这个时,我的整个页面都包含在一个 UpdatePanel 中(其 UpdateMode 为“始终”),因此这似乎不对。这是怎么回事?
I've got a .ascx server control in ASP.NET 2.0 that contains several other .ascx server controls. Everything in the top-level one is wrapped in an UpdatePanel. It works great until the second time I do something on the page, and then I get this error in an alert dialog:
Invalid postback or callback argument. Event validation is enabled using in configuration or <%@ Page EnableEventValidation="true" %> in a page. For security purposes, this feature verifies that arguments to postback or callback events originate from the server control that originally rendered them. If the data is valid and expected, use the ClientScriptManager.RegisterForEventValidation method in order to register the postback or callback data for validation.
This seems like a common error; a Google search turns up several results. They all seem to say that if a postback happens, you have to make sure to call Update on any UpdatePanels that contain controls that were updated. But when I'm debugging this my whole page is contained inside one UpdatePanel (whose UpdateMode is Always), so that doesn't seem right. What's going on?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论