【发布时间】:2016-05-19 05:02:08
【问题描述】:
我有两个使用 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>
【问题讨论】: