I keep getting the dredded "Conversion from type 'DBNull' to type 'Boolean' is not valid." error and cannot seem to get around it.
I was getting it when I clicked on Add new record and worked around that by adding default values in code behind:
If (e.CommandName = Telerik.Web.UI.RadGrid.InitInsertCommandName) Then
'cancel the default operation
e.Canceled = True
'Prepare an IDictionary with the predefined values
Dim newValues As System.Collections.Specialized.ListDictionary = New System.Collections.Specialized.ListDictionary()
'set default checked state for checkbox inside the EditItemTemplate
newValues("Is_Admin") = False
newValues("Is_Disabled") = False
'Insert the item and rebind
e.Item.OwnerTableView.InsertItem(newValues)
End If
But now if I'm in insert mode, so I have clicked on Add New Record then without cancelling insert click on edit I get the error again. If I cancel the insert by clicking cancel then the error does not appear. Is there a way to cancel the insert in code behind before the grid is put in edit mode to avoid this error?
Paula