message from webpage invalid postback or callback argument. event validation is enabled using
My goal is to have the user be able to click the row and the row will be the selected row almost like having the select button but the entire row clickable to do the same thing
the error i get popups when i click the row, not when the webpage is loaded
this is the onrowdatabound portion i just added that causes the error
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
This is my full on 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
Set EnableEventValidation to False in Page directive of the aspx page (markup).
精彩评论