【问题标题】:Why I got this exception :Sys.WebForms.PageRequestManagerServerErrorException: Invalid postback or callback argument为什么我得到这个异常:Sys.WebForms.PageRequestManagerServerErrorException: Invalid postback or callback argument
【发布时间】:2012-02-22 06:14:09
【问题描述】:

为什么会出现这个错误

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.

当 Save 命令的事件启动时出现此错误

  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

【问题讨论】:

    标签: asp.net vb.net jscript


    【解决方案1】:

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

    【讨论】:

    • 这只是隐藏了错误。设置这些属性无法解决此错误的影响。
    • 谢谢...使用aspx页面很痛苦
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-10-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多