来自网页的消息无效的回发或回调参数。事件验证使用

时间:2011-05-16 19:03:05

标签: asp.net vb.net

我的目标是让用户能够单击该行,并且该行将是所选行,几乎就像使用选择按钮但整个行可单击以执行相同的操作

错误我点击该行时弹出窗口,而不是在加载网页时弹出

这是我刚刚添加的onrowdatabound部分导致错误

        If e.Row.RowType = DataControlRowType.DataRow Then
            ' Get reference to button field in the gridview.
            Dim _singleClickButton As LinkButton = DirectCast(selectbutton, LinkButton)
            Dim _jsSingle As String = ClientScript.GetPostBackClientHyperlink(_singleClickButton, "Select$" & Convert.ToString(e.Row.RowIndex))
            e.Row.Style("cursor") = "hand"
            e.Row.Attributes("onclick") = _jsSingle
        End If

这是我在rowdatabound上的全部内容

 Protected Sub GridView6_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs)
            ' CHECK THE ROW TYPE HERE. ONLY EXECUTE ON DataRow     
            If e.Row.RowType = DataControlRowType.DataRow Then
                Dim date1 As Date
                date1 = Date.Now
                Dim date2 As Date

                Dim ddate As Label = CType(e.Row.FindControl("duedate"), Label)
                date2 = Date.Parse(ddate.Text)
                Dim ts As TimeSpan = date2.Subtract(date1)
                Dim days As Integer = ts.TotalDays

                If days <= 14 And days >= 0 Then
                    e.Row.ForeColor = System.Drawing.Color.Blue
                    bluecount = bluecount + 1
                ElseIf days > 14 And days < 30 Then
                    e.Row.ForeColor = System.Drawing.Color.Black
                    blackcount = blackcount + 1
                ElseIf days >= 30 Then
                    e.Row.ForeColor = System.Drawing.Color.Green
                    greencount = greencount + 1
                ElseIf days < 0 Then
                    e.Row.ForeColor = System.Drawing.Color.Red
                    redcount = redcount + 1
                End If


                Dim link As HyperLink = CType(e.Row.FindControl("HyperLink1"), HyperLink)
                Dim id As Label = CType(e.Row.FindControl("id"), Label)



                Dim selectbutton As LinkButton = CType(e.Row.FindControl("linkbutton1"), LinkButton)


            If e.Row.RowType = DataControlRowType.DataRow Then
                ' Get reference to button field in the gridview.
                Dim _singleClickButton As LinkButton = DirectCast(selectbutton, LinkButton)
                Dim _jsSingle As String = ClientScript.GetPostBackClientHyperlink(_singleClickButton, "Select$" & Convert.ToString(e.Row.RowIndex))
                e.Row.Style("cursor") = "hand"
                e.Row.Attributes("onclick") = _jsSingle
            End If


                link.NavigateUrl = "Default7.aspx?id=" + id.Text + "&uid=" + user1


                pduecount.Text = redcount
                next14count.Text = bluecount
                fteencount.Text = blackcount
                thirtycount.Text = greencount


            End If







        End Sub

1 个答案:

答案 0 :(得分:0)

在aspx页面的标记指令(标记)中将EnableEventValidation设置为False。