Hi All,
For one filed in my databound grid, I need to convert it from a textbox to a checkbox. But I cannot figure out the exact coding. I tried this but it doesn't work. It bombs out on the DIM statement below:
Sub LoadItemData(ByVal sender As Object, ByVal e As DataGridItemEventArgs)
If e.Item.DataItem("DataType") = "Checkbox" Then
Dim ChkBox As CheckBox = CType(e.Item.Cells(1).Controls(1), CheckBox)
If e.Item.DataItem("ValueData") = "0" Or e.Item.DataItem("ValueData") = "N" Then
CType(e.Item.Cells(1).Controls(1), CheckBox).Checked = False
Else
CType(e.Item.Cells(1).Controls(1), CheckBox).Checked = True
End If
end if
end sub
For one filed in my databound grid, I need to convert it from a textbox to a checkbox. But I cannot figure out the exact coding. I tried this but it doesn't work. It bombs out on the DIM statement below:
Sub LoadItemData(ByVal sender As Object, ByVal e As DataGridItemEventArgs)
If e.Item.DataItem("DataType") = "Checkbox" Then
Dim ChkBox As CheckBox = CType(e.Item.Cells(1).Controls(1), CheckBox)
If e.Item.DataItem("ValueData") = "0" Or e.Item.DataItem("ValueData") = "N" Then
CType(e.Item.Cells(1).Controls(1), CheckBox).Checked = False
Else
CType(e.Item.Cells(1).Controls(1), CheckBox).Checked = True
End If
end if
end sub