无效的回发或回调参数。使用'<pages enableeventvalidation =“”true“/”>'启用事件验证

时间:2015-06-29 06:13:06

标签: vb.net

我如何解决这个问题。每次我点击查看/编辑按钮,它显示错误页面,这是无效的回发或回调参数。使用配置或&lt;%@ Page EnableEventValidation =“true”%&gt;启用事件验证在一个页面中。出于安全考虑,此功能可验证回发或回调事件的参数是否来自最初呈现它们的服务器控件。如果数据有效且符合预期,请使用ClientScriptManager.RegisterForEventValidation方法注册回发或回调数据以进行验证。

Imports eClaim.RegistrySettings

公共类货币列表

Inherits System.Web.UI.Page

Dim mydb As New DbInterface(EHRMSWEB_CONN)
'Dim regVal As New RegistrySettings()
Dim ds As DataSet
Dim dt As DataTable
Dim path As New FilePath
Dim APPSETTINGPath As String
Dim strFirstDayofWk As String

Protected WithEvents txtSortExpression As System.Web.UI.WebControls.TextBox
Protected WithEvents dg As System.Web.UI.WebControls.DataGrid





<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()

End Sub

Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
    'CODEGEN: This method call is required by the Web Form Designer
    'Do not modify it using the code editor.
    InitializeComponent()
End Sub



Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    If Session("UserId") = "" Or (Session("UserType") <> 3 And Session("UserType") <> 2) Then
        Response.Redirect("redirect_admin.aspx?url=login_admin.aspx")
    End If

    APPSETTINGPath = path.LocatePath(4)
    strFirstDayofWk = path.getAppSetting(2, APPSETTINGPath)

    ds = Open_CLCURRENCY(mydb.dbConnEHrmsWeb, mydb.DAeHrmsWeb, 2)
    dt = ds.Tables("CLCURRENCY")
    dg.DataSource = dt
    dg.DataBind()
End Sub

Private Sub dg_SortCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridSortCommandEventArgs) Handles dg.SortCommand
    Dim dv As DataView = dt.DefaultView

    dv.Sort = e.SortExpression
    txtSortExpression.Text = e.SortExpression
    dg.DataSource = dv
    dg.DataBind()
End Sub

Private Sub dg_PageIndexChanged(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridPageChangedEventArgs) Handles dg.PageIndexChanged
    Dim dv As DataView = dt.DefaultView
    If txtSortExpression.Text <> "" Then
        dv.Sort = txtSortExpression.Text
    End If
    dg.DataSource = dv
    dg.DataBind()
End Sub

Private Sub dg_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs) Handles dg.ItemDataBound

    If e.Item.ItemIndex <> -1 Then
        Dim btnExRt As Button = e.Item.FindControl("btnExRt")
        Dim strPage As String
        If e.Item.DataItem("Ex_Rt_Type") = 0 Then
            strPage = "currencyratemonthly.aspx?"
        ElseIf e.Item.DataItem("Ex_Rt_Type") = 1 Then

            strPage = "currencyrateweekly.aspx?firstday=" & strFirstDayofWk & "&"
        ElseIf e.Item.DataItem("Ex_Rt_Type") = 2 Then
            strPage = "currencyratedaily.aspx?"
        End If
        btnExRt.Attributes.Add("OnClick", "javascript:window.open('" & strPage & "CurrCd=" & e.Item.DataItem("CurrencyCd") & "','View','toolbar=no,resizable=yes,scrollbars=yes,left=0,top=0,screenX=0,screenY=0,width=675,height=500');")
    End If
End Sub

Protected Sub dg_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles dg.SelectedIndexChanged

End Sub

结束班

希望你能帮我解决这个问题并提前感谢你。

0 个答案:

没有答案