Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
2430
Checkbox on a Grid not defaulting as expected
posted

This is probably an easy 1 minute question but...

I have a DataSet that has an integer which is one of 3 values (0, 1, NULL).

I bind this data set to the grid and set the column as a checkbox.  Most of the values are NULL and I want NULL to default to unchecked state but it defaults to checked state.

I went and set the Nullable Text to 0 and the Default Value to decimal 0.

It still comes out as checked.  What am I doing wrong?

  • 469350
    Offline posted

    Hi,

    Are you sure the value is Null? A DataTable/DataSet usually uses DBNull instead of Null.

    In any case, I tested this out using both null and DBNull and it works correctly for me. The null/DBNull fields display the CheckBox in the Indeterminate state, not as checked. This happens regardless of whether I use CheckBox or TriStateCheckbox as the column's Style.