无效的 Postback 导致验证失败。

3
我有两个使用javascript移动项目的列表框。项目已正确移动,但当我按保存按钮时,会出现以下错误:

无效的回发或回调参数。

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

我的aspx:

<asp:UpdatePanel ID="update" runat="server">
    <Triggers>
        <asp:AsyncPostBackTrigger ControlID="btnSave" />
    </Triggers>
    <ContentTemplate>         
        <table >
            <tr>
                <td>                               
                    <asp:ListBox  ID="lstbx" runat="server" ClientIDMode="Static" ></asp:ListBox>
                </td>
                <td>                           
                    <a href="#" id="movenext" class="anchor">Move ></a>
                    <a href="#" id="moveprev" class="anchor">< Move</a>
                </td>
                <td>
                    <asp:ListBox ID="lstbx2" runat="server" ClientIDMode="Static" ></asp:ListBox>
                </td>
            </tr>
        </table>
    </ContentTemplate>
</asp:UpdatePanel>

<p class="btnCentre">
    <asp:Button runat="server" ID="btnSave" Text="Save" ValidationGroup="ValGroup" CausesValidation="true"  />
    <asp:Label runat="server" ID="lbl_Savemsg"></asp:Label>
    <asp:Button runat="server" ID="btnCancel" Text="Cancel" CausesValidation="false" />
    <asp:HiddenField runat="server" ID="hiddenfield" />
</p>
1个回答

1

你需要将 enablevalidation 改为 false
来自

<pages enableEventValidation="true"/> 

to

<pages enableEventValidation="false"/>

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接