我收到以下错误:

Server Error in '/' Application.

Invalid postback or callback argument.  Event validation is enabled using <pages enableEventValidation="true"/> 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.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.ArgumentException: Invalid postback or callback argument.  Event validation is enabled using <pages enableEventValidation="true"/> 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.

Source Error: 

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace: 


[ArgumentException: Invalid postback or callback argument.  Event validation is enabled using <pages enableEventValidation="true"/> 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.]
   System.Web.UI.ClientScriptManager.ValidateEvent(String uniqueId, String argument) +8627417
   System.Web.UI.WebControls.ListBox.LoadPostData(String postDataKey, NameValueCollection postCollection) +360
   System.Web.UI.WebControls.ListBox.System.Web.UI.IPostBackDataHandler.LoadPostData(String postDataKey, NameValueCollection postCollection) +13
   System.Web.UI.Page.ProcessPostData(NameValueCollection postData, Boolean fBeforeLoad) +346
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1743

Version Information: Microsoft .NET Framework Version:2.0.50727.3623; ASP.NET Version:2.0.50727.3618

这是什么意思?

以下是我的代码:

<%@ Page EnableEventValidation="true" Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="EnterData.DataEntry.WebForm1" %>    

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title></title>

    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js" type="text/javascript"></script>
    <script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/jquery-ui.js" type="text/javascript"></script>

    <link href="../niceforms/niceforms-default.css" rel="stylesheet" type="text/css" />
    <script src="../niceforms/niceforms.js" type="text/javascript"></script>

    <link href="../jquery-ui-1.8.16.custom.css" rel="stylesheet" type="text/css" />
    <style type="text/css">
        .list-problems {
        height:600px !important;
        width:200px !important;
        display:inline-block;
    }
    </style>

    <script>
        jQuery(function($) {
        //$("#occurrence_dateTextBox").mask("99/99/9999");
        //$("#<%= report_dateTextBox.ClientID %>").mask("99/99/9999");
        $("#<%= occurrence_dateTextBox.ClientID %>").datepicker();
        $("#<%= report_dateTextBox.ClientID %>").datepicker();
        //$(".datepicker").datepicker(); 

    });
    $(function() {
        $.get('../file.txt', function(data) {
            var output = data.split('\n'),
            tmp = '';
            for (i = 0; i < output.length; i++) {
                tmp += '<option value=' + output[i] + '>' + output[i] + '</option>';
            }
            $('#lstProblems').html(tmp);

        });
    });

    $(function() {
        $("select").multiselect();
    });

    function getselectedproblems() {
        var selectedLanguages = new Array();
        jQuery('#lstProblems option:selected').each(function() {
            selectedLanguages.push(jQuery(this).val());
        });
    }

    </script>

</head>
<body><div id="container">
    <form id="form1" runat="server" class="niceform">

        <fieldset>

        <legend>Section A</legend>

        <dl>

            <dt><label for="occurrence_dateTextBox" >Occurrence Date:</label></dt>
            <dd><asp:TextBox ID="occurrence_dateTextBox" runat="server" size="50"/></dd>
        </dl>

        <dl>

            <dt><label for="report_dateTextBox">Report Date:</label></dt>
            <dd><asp:TextBox ID="report_dateTextBox" runat="server" size="50"/></dd>
        </dl>

        <dl>

            <dt><label for="spec_idTextBox">Specimen ID:</label></dt>
            <dd><asp:TextBox ID="spec_idTextBox" runat="server" size="50"/></dd>
        </dl>

        <dl>

            <dt><label for="batch_idTextBox">Batch ID:</label></dt>
            <dd><asp:TextBox ID="batch_idTextBox" runat="server" size="50"/></dd>
        </dl>

        <dl>

            <dt><label for="report_byTextBox">Report By:</label></dt>
            <dd><asp:TextBox ID="report_byTextBox" runat="server" size="50"/></dd>
        </dl>

        <dl>

            <dt><label for="identified_byTextBox">Identified ID:</label></dt>
            <dd><asp:TextBox ID="identified_byTextBox" runat="server" size="50"/></dd>
        </dl>

        </fieldset>

        <fieldset>
        <legend>Section B</legend>

        <dl>

            <dt><label for="problemTextBox">Problem:</label></dt>
            <dd><asp:TextBox ID="problemTextBox" runat="server" size="50"/></dd>


        </dl>

        <dl>
            <dt><label for="lstProblems">Problems List:</label></dt>
            <dd>
                <asp:ListBox ID="lstProblems" runat="server" SelectionMode="Multiple" CssClass="list-problems"></asp:ListBox>
            </dd>

        </dl>  

        <dl>
                <dd><select size="8" multiple="true" >
                <optgroup label="Europe">
                    <option>United Kingdom</option>
                    <option>Luxembourg</option>
                </optgroup>    
                <optgroup label="Asia">
                    <option>India</option>
                    <option>Dubai</option>
                </optgroup>
            </select> </dd>    
        </dl>
        <dl>
            <asp:ListBox ID="ListBox1" runat="server" DataSourceID="SqlDataSource1" 
                DataTextField="batch" DataValueField="batch" SelectionMode="Multiple" 
                Height="100px" Width="329px"></asp:ListBox>
            <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
                ConnectionString="<%$ ConnectionStrings:LOM %>" 
                SelectCommand="SELECT [batch] FROM [lom_batch]"></asp:SqlDataSource>
        </dl>

        </fieldset>

        <fieldset>
        <legend>Section C</legend>
        <dl>

            <dt><label for="section_c_issue_error_identified_byTextBox">Issue/Error Identified By:</label></dt>
            <dd><asp:TextBox ID="section_c_issue_error_identified_byTextBox" runat="server" size="50"/></dd>


        </dl>

        <dl>

            <dt><label for="section_c_commentsTextBox">Comments:</label></dt>
            <dd><asp:TextBox ID="section_c_commentsTextBox" runat="server" size="50"/></dd>


        </dl>       

        </fieldset>

        <fieldset>
        <legend>Section D</legend>
        <dl>

            <dt><label for="section_d_investigationTextBox">Investigation:</label></dt>
            <dd><asp:TextBox ID="section_d_investigationTextBox" runat="server" size="50"/></dd>


        </dl>

        </fieldset>

        <fieldset>
        <legend>Section E</legend>
        <dl>

            <dt><label for="section_e_corrective_actionTextBox">Corrective Action:</label></dt>
            <dd><asp:TextBox ID="section_e_corrective_actionTextBox" runat="server" height="200" TextMode="MultiLine" size="50"/></dd>


        </dl>


        </fieldset>

        <fieldset>
        <legend>Section F</legend>
        <dl>

            <dt><label for="section_f_commentsTextBox">Comments:</label></dt>
            <dd><asp:TextBox ID="section_f_commentsTextBox" runat="server" size="50"/></dd>


        </dl>

        </fieldset>

        <fieldset>
        <legend>Pre-Analytical</legend>
        <dl>

            <dt><label for="prePracticeCodeTextBox">Practice Code:</label></dt>
            <dd><asp:TextBox ID="prePracticeCodeTextBox" runat="server" Visible="false"/></dd>


        </dl>

        <dl>

            <dt><label for="preContactTextBox1">Contact:</label></dt>

            <dd><asp:TextBox ID="preContactTextBox" runat="server" Visible="false"/></dd>


        </dl>

        <dl>
            <dt><label for="CheckBox1">PreAnalytical?</label></dt>
            <dd> <asp:CheckBox ID="CheckBox1" runat="server" CausesValidation="false"
                            Visible="true" AutoPostBack="true" OnCheckChanged="CheckBox1_CheckedChanged"/></dd>
        </dl>

        </fieldset>

        <asp:Button ID="Button1" runat="server" Text="Button" OnClick="SubmitData"  OnClientClick="JSfunction()"/>

    </form>

</div></body>
</html>

我做错了什么?

我按下提交按钮后出现此错误.

推荐答案

在您的ASPX文件中,您应该将第一行放在下面:

<%@ Page EnableEventValidation="false" %>

if you already have something like <%@ Page so just add the rest => EnableEventValidation="false" %>

我建议不要这样做.

Asp.net相关问答推荐

如何在 ASP.NET RadioButtonList 中的项目之间添加空格

在每个对象上设置 ClientIDMode = Static 是否有任何缺点(在母版页的 maincontent 上设置)

使用 Asp.Net MVC 和 KnockoutJS 处理日期

Web API 自托管 - 在所有网络接口上绑定

如何从 dll 文件中提取类的源代码?

是否可以在没有那些 .svn 文件夹的情况下从 subversion 签出文件?

使用 C# 和 ASP.NET 从 Gmail/Hotmail/Yahoo 导入通讯簿

将 null 转换为字符串的函数

多行文本框多个换行符

如何在 ASP.NET Web API 中使用非线程安全的 async/await API 和模式?

如何在 ASP.NET 下拉列表中添加选项组?

在 asp.net 中为动态 PDF 指定文件名

DBContext.Entry 有什么作用?

由 UpdatePanel 内 GridView 内的 LinkBut​​ton 触发的完整回发

如何在 ASP.NET 中设置下拉列表项?

如何在 GridView 中隐藏 TemplateField 列

如何获取程序集的最后修改日期?

如何response.write bytearray?

jQuery Ajax 调用 - 成功设置变量值

为什么调试器不会在我的 ASP.NET 应用程序的断点处停止?