Conditionally display fields in a gridview (ASP.Net)

The following code will display one of two fields based on the value of the first field. Place the following vb code within the RowDataBound event.
If e.Row.Cells(0).Text > "A" Then e.Row.Cells(7).Visible = True e.Row.Cells(8).Visible = False Else e.Row.Cells(7).Visible = False e.Row.Cells(8).Visible = True End If

e.Row.Cells(0).Visible = False

This entry was posted in Uncategorized. Bookmark the permalink.