VB.net webform pulling data from Sql database to gridview.
I have two Bit Columns Rush and Normal - In the code behind if Rush is Checked then the row cells turn Red and Normal turns blue.
The problem I have is the bit is True or False not having much luck converting them to Integer or Int32.
Here is a code I am working with, this code turn all rows blue , if cell 7 not equal to 1.
If I go to Rush cell(10) error input string not in correct format.
Question is how to convert bit from True/false to 1/0 or correct format.
Protected Sub OnRowDataBound(sender As Object, e As GridViewRowEventArgs)
If e.Row.RowType = DataControlRowType.DataRow Then
Dim sh As String = Convert.ToInt32(e.Row.Cells(7).Text)
For Each cell As TableCell In e.Row.Cells
If sh = 1 Then
cell.BackColor = Drawing.Color.Red
Else
cell.BackColor = Drawing.Color.Blue
End If
Next
End If
End Sub