I am trying to create a checkbox based on the value of a column in a GridView. In my case below, if the column value is 'N' I would like to row value to create a checkbox. Is this possible? If yes, What is the proper line of code? Am I only able to do this if I currently have a checkbox? (Instead of creating it on the fly?
Here is my current code:
If (e.Row.RowType = DataControlRowType.DataRow) Then
Dim dr As DataRowView = CType(e.Row.DataItem, DataRowView)
If dr("Active").ToString() = "N" Then
'e.Row.Cells(6).ForeColor = Drawing.Color.Red
e.Row.Cells(6).FindControl("CheckBox")
Else
e.Row.Cells(6).ForeColor = Drawing.Color.Green
End If
End If
Aucun commentaire:
Enregistrer un commentaire