Hello,
I'm having two problems with this Try It Out which is perplexing since the coding is so simple.
My first problem comes by entering the code in step 3. If I run the page with this code I get an error "Declaration expected" after line 1 of the code.
Code:
VB.NET
Imports System.Data
Partial Class Management_Reviews
Inherits System.Web.UI.Page
Protected Function GetBooleanText(ByVal booleanValue As Object) As String
Dim authorized As Boolean = CType(booleanValue, Boolean)
If authorized Then
Return "Yes"
Else
Return "No"
End If
End Function
Protected Sub GridView1_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GridView1.RowDataBound
Select Case e.Row.RowType
Case DataControlRowType.DataRow
Dim myRowView As DataRowView = CType(e.Row.DataItem, DataRowView)
If Not Convert.ToBoolean(myRowView("Authorized")) Then
e.Row.CssClass = "HighContrast"
End If
End Select
End Sub
End Class
If I try running the page without the code from step 3, I get an error "Type 'DataRowView' is not defined."
Jason