为什么我得到此异常:Sys.WebForms.PageRequestManagerServerErrorException:无效的回发或回调参数

Bad*_*der 2 vb.net asp.net jscript

为什么我收到此错误

Microsoft JScript runtime error: Sys.WebForms.PageRequestManagerServerErrorException: 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.
Run Code Online (Sandbox Code Playgroud)

启动"保存"命令的事件时,将显示此错误

  Protected Sub DataList1_ItemCommand(source As Object, e As System.Web.UI.WebControls.DataListCommandEventArgs) Handles dlMainTraing.ItemCommand
        If e.CommandName = "Save" Then
            Dim lblMainId = CType(dlMainTraing.Items(e.Item.ItemIndex).FindControl("Train_M_IndxLabel"), Label)
            Dim txtSubTrainingName2 = CType(dlMainTraing.Items(e.Item.ItemIndex).FindControl("txtSubTrainingName"), TextBox)
            Dim a = addSubTraining(CInt(lblMainId.Text), txtSubTrainingName2.Text)
            ' Dim gvSubTraning As GridView = CType(e.Item.FindControl("gvSubTraning"), GridView)
            'gvSubTraning.DataBind()
        End If

    End Sub
Run Code Online (Sandbox Code Playgroud)

Ind*_*ter 12

在.aspx页面的顶部,将EnableEventValidation设置为false.

在此输入图像描述

  • 这只是隐藏错误.通过设置这些属性无法解决此错误的影响. (5认同)