【问题标题】:Invalid Postback not allowing the validation无效的回发不允许验证
【发布时间】: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>

【问题讨论】:

    标签: c# asp.net


    【解决方案1】:

    您需要将 enablevalidation 更改为 false
    来自

    <pages enableEventValidation="true"/> 
    

    <pages enableEventValidation="false"/>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-01-18
      • 1970-01-01
      • 1970-01-01
      • 2011-04-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-04-01
      相关资源
      最近更新 更多