使用 javascript 修改控件 - 无效的回发或回调参数

发布于 2024-10-10 01:53:01 字数 534 浏览 0 评论 0原文

我在页面上有一个下拉菜单

                            <asp:DropDownList ID="drpName" AutoPostBack="true" AppendDataBoundItems="true" runat="server" ></asp:DropDownList>

,有时我想使用 javascript/jquery 向其中添加项目。

当我选择已添加的项目并进行回发时,我收到以下错误:

*无效的回发或回调参数。使用配置或 <%@ Page EnableEventValidation="true" %> 启用事件验证在一个页面中。出于安全目的,此功能验证回发或回调事件的参数是否源自最初呈现它们的服务器控件。如果数据有效且符合预期,请使用 ClientScriptManager.RegisterForEventValidation 方法来注册回发或回调数据以进行验证。 *

关于如何解决这个问题有什么想法吗?

谢谢,

I have a a dropdown on a page

                            <asp:DropDownList ID="drpName" AutoPostBack="true" AppendDataBoundItems="true" runat="server" ></asp:DropDownList>

and I on occasion want to add items to it using javascript/jquery.

When I select the items that have been added and it does a postback I get the following error:

*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. *

Any ideas on how to get around this?

Thanks,

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

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文