I am trying to change the backgound color on a datarow in a gridview while it is being built by using an event in the properties of the gridview. I found an example for an integer check but the field I want to check is a text field with the words "STANDARD" OR "SIGNIFICANT" stored in the field within the database. Here is the code I am executing below but I get the error below. (I am including the code I found that does the integer check at the bottom so you can see it as well). Anyone got any idea as to my problem?
Error 5 Overload resolution failed because no accessible '=' can be called with these arguments: 'Public Shared Operator =(a As String, b As String) As Boolean': Value of type '1-dimensional array of Object' cannot be converted to 'String'.
Sub typeGridView_RowDataBound(ByVal sender As Object, _
ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs)
If e.Row.RowType = DataControlRowType.DataRow Then
'determine the value of the type field
Dim whattype(DataBinder.Eval(e.Row.DataItem, "type"))
If whattype = "STANDARD" Then
' color the background of the row yellow
e.Row.BackColor = Drawing.Color.Yellow
End If
End If
End Sub
Code example I found that does an interger.....
Sub productsGridView_RowDataBound(ByVal sender As Object, _
ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs)
If e.Row.RowType = DataControlRowType.DataRow Then
'determine the value of the UnitsInStock field
Dim unitsInStock As Integer = _
Convert.ToInt32(DataBinder.Eval(e.Row.DataItem, _
"UnitsInStock"))
If unitsInStock = 0 Then
' color the background of the row yellow
e.Row.BackColor = Drawing.Color.Yellow
End If
End If
End Sub