Hi,
I am trying to use a data bound Checkbox in a RadGrid Template Column but have come across several problems.
Firstly, i was trying to use the asp checkbox control. This works for displaying the existing data from my database but i get a DBnull error when i try to insert a new record.
So i tried to resolve this error by trying to capture the DBNull with a CheckNull function:
but this didn't work. I then tried a custom CheckBox which overrides the DBNull error but this didn't fix the problem either
I then searched the Telerik forums for a solution & came across the telerik:GridCheckBoxColumn (from this site http://demos.telerik.com/aspnet-ajax/grid/examples/dataediting/alleditablecolumns/defaultcs.aspx) BUT i do not have this available to me! When i enter this control i get an error saying it does not exist.
Is this an old control item which has been phased out or should it still be available to me on the latest version of Telerik controls?
if it isn't available then can you provide an alternative solution for the databound checkbox which is causing a DBnull conversion error?
Regards,
Shuja
I am trying to use a data bound Checkbox in a RadGrid Template Column but have come across several problems.
Firstly, i was trying to use the asp checkbox control. This works for displaying the existing data from my database but i get a DBnull error when i try to insert a new record.
So i tried to resolve this error by trying to capture the DBNull with a CheckNull function:
Public
Function
CheckNull(
ByVal
val
As
Object
)
As
Boolean
If
val.
GetType
Is
DBNull.Value.
GetType
Then
Return
False
Else
Return
Convert.ToBoolean(val)
End
If
End
Function
but this didn't work. I then tried a custom CheckBox which overrides the DBNull error but this didn't fix the problem either
Public
Class
CustomCheckBox
Inherits
Web.UI.WebControls.CheckBox
Public
Property
CheckedOverride()
As
Object
Get
Return
MyBase
.Checked
End
Get
Set
(
ByVal
value
As
Object
)
If
IsDBNull(value)
Then
MyBase
.Checked =
False
ElseIf
value.
GetType
() =
GetType
(
Boolean
)
Then
MyBase
.Checked = value
Else
MyBase
.Checked =
False
End
If
End
Set
End
Property
End
Class
I then searched the Telerik forums for a solution & came across the telerik:GridCheckBoxColumn (from this site http://demos.telerik.com/aspnet-ajax/grid/examples/dataediting/alleditablecolumns/defaultcs.aspx) BUT i do not have this available to me! When i enter this control i get an error saying it does not exist.
Is this an old control item which has been phased out or should it still be available to me on the latest version of Telerik controls?
if it isn't available then can you provide an alternative solution for the databound checkbox which is causing a DBnull conversion error?
Regards,
Shuja