The Syncfusion native Blazor components library offers 70+ UI and Data Viz web controls that are responsive and lightweight for building modern web apps.
.NET PDF framework is a high-performance and comprehensive library used to create, read, merge, split, secure, edit, view, and review PDF files in C#/VB.NET.
I have a datagrid in my column that has one DataGridBoolColumn (check box) and several text columns. I created bool column with a following code:
Dim Col As New DataGridBoolColumn()
Col.HeaderText = "Select"
Col.MappingName = "Select"
Col.AllowNull = False
Col.TrueValue = True
Col.FalseValue = False
tableStyle.GridColumnStyles.Add(unboundColStyle)
After this I have a column with a check box. Now I'd like to get rid of this DBNull value that comes when I click the check box. I added this code to the mouseDown event in the grid:
Dim hti As DataGrid.HitTestInfo = Me.dgr.HitTest(e.X, e.Y)
Try
If hti.Type = DataGrid.HitTestType.Cell AndAlso hti.Column = 0 Then
Me.dgr(hti.Row, hti.Column) = Not CBool(dgr(hti.Row, hti.Column))
End If
Catch ex As Exception
MessageBox.Show(ex.ToString())
End Try
This code crashes because checkbox has a value DBNull. So, how to get rid of this DBNull value? And does anyone know why the check box is disabled(gray) at the beginning?
ADAdministrator Syncfusion Team March 26, 2003 03:13 PM UTC
The grey box means the value is NULL.
> I have a datagrid in my column that has one DataGridBoolColumn (check box) and several text columns. I created bool column with a following code:
>
> Dim Col As New DataGridBoolColumn()
>
> Col.HeaderText = "Select"
> Col.MappingName = "Select"
>
> Col.AllowNull = False
>
> Col.TrueValue = True
> Col.FalseValue = False
>
> tableStyle.GridColumnStyles.Add(unboundColStyle)
>
> After this I have a column with a check box. Now I'd like to get rid of this DBNull value that comes when I click the check box. I added this code to the mouseDown event in the grid:
>
>
> Dim hti As DataGrid.HitTestInfo = Me.dgr.HitTest(e.X, e.Y)
>
> Try
>
> If hti.Type = DataGrid.HitTestType.Cell AndAlso hti.Column = 0 Then
>
> Me.dgr(hti.Row, hti.Column) = Not CBool(dgr(hti.Row, hti.Column))
>
> End If
>
> Catch ex As Exception
> MessageBox.Show(ex.ToString())
> End Try
>
> This code crashes because checkbox has a value DBNull. So, how to get rid of this DBNull value? And does anyone know why the check box is disabled(gray) at the beginning?