小编典典

asp.net:无效的回发或回调参数

html

我收到此错误:

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>

我究竟做错了什么?

按提交按钮后出现此错误。


阅读 243

收藏
2020-05-10

共1个答案

小编典典

在您的aspx文件中,您应该这样放置第一行:

<%@ Page EnableEventValidation="false" %>

如果您已经有类似的东西, <%@ Page 那么只需添加其余的=>EnableEventValidation="false" %>

我建议不要这样做。

2020-05-10