This is a migrated thread and some comments may be shown as answers.

Filter Error when CheckBox column has Null values

2 Answers 81 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Steve Hogg
Top achievements
Rank 1
Steve Hogg asked on 01 Dec 2014, 07:24 PM
I just upgraded to Telerik UI for WinForms 2014 from 2010.

I have an application with about 40 grids we build dynamically that have checkbox columns. Many of the tables feeding these grids have NULL values for the bit column. When applying a filter to a grid that has NULL values in the CheckBox column I get an error. If I modify my query using ISNULL(fieldname, 0) AS fieldname I am able to filter, but I can no longer update the bit field for that CheckBox column because it is now aliased.

Before the upgrade the filtering worked even if there were NULL values. What can I do to get both filtering and update capability on CheckBox columns that reference a bit column that contains NULL values. The underlying data cannot be changed to eliminate NULL values because a NULL represents a state other than true or false when handling data in our stored procedures.

This is the code used to create the CheckBox columns:

ElseIf objTab.Columns(i).DataType.Name = "Boolean" Then
Dim col As GridViewCheckBoxColumn = New GridViewCheckBoxColumn
col.Name = colname
col.FieldName = colname
col.HeaderText = colname
col.ReadOnly = Not (pCanWrite)
objGrd.Columns.Add(col)

2 Answers, 1 is accepted

Sort by
0
Steve Hogg
Top achievements
Rank 1
answered on 04 Dec 2014, 01:10 PM
Issue resolve with Q3 service pack 1
0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 04 Dec 2014, 01:42 PM
Hello Steve,

Thank you for writing.

Your question has already been answered in the support thread that you have opened on the same topic. However, I am posting the answer here as well so the community can benefit from it.

I confirm that it is a known issue when filtering the RadGridView and GridViewCheckBoxColumn exists with DBNull.Value. Here is the feedback item for your reference. As you have already found out, the fix is introduced in Q3 2014 SP1.

Currently, due to the specificity of the issue, the possible solution that we can suggest for the specific version is to initialize default value (true/false) for the cells belonging to GridViewCheckBoxColumn if it is DBNull. Another approach is to create a DataTable filled with the specific data where the check box column will be typeof(ToggleState). Thus, for all DBNull values you can use ToggleState.Indeterminate.

I hope this information helps. Should you have further questions, I would be glad to help.

Regards,
Desislava
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
GridView
Asked by
Steve Hogg
Top achievements
Rank 1
Answers by
Steve Hogg
Top achievements
Rank 1
Dess | Tech Support Engineer, Principal
Telerik team
Share this question
or