471,337 Members | 1,132 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,337 software developers and data experts.

Why is boolean column always checked?

I convert a collection to DataSet, reference the first table and throw
that into a DataTable. The DataTable is used as a DataSource for a
DataGrid. The DataGrid has an associated GridTableSyle.

I use the RowChanged() event on a DataTable to capture changed column
data. I get their values and update the collection without errors:

Person.addresscollection[0].IsMailing =
Convert.ToBoolean(e.Row["IsMailing"].ToString());

When the grid has finished initially loading, the IsMailing boolean
column is grayed and checked. I click it once to give focus. Then
click again to uncheck. It also ungreys on the second click. Once I
move off this column, it grays and checks itself. The value for the
above collection field is always false. That is the value coming off
the grid or the above conversion.

I'm setting readonly to false for the boolean column when setting up
the gridtablestyle. Any ideas why the boolean is acting this way in
the grid?

Thanks,
Brett

Jan 17 '06 #1
2 1410
The checkbox in a datagrid has 3 states, i.e. if the data value is NULL
rather than TRUE of FALSE, the checkbox is cheched and grayed. So to
solve this problem, you should set the boolean data value to FALSE if
it is NULL.

Jan 18 '06 #2
I have only one row in the grid. I see the two boolean columns coming
out of the table have true/false values. I supply the grid this way:

dgAddress.DataSource = dtAddress;

It should be fine. How else can I check if the values are null? I
also have the DataGridBoolColumn set to AllowNull = false.

Thanks,
Brett

Jan 18 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by Wayne Wengert | last post: by
3 posts views Thread by Gene Hubert | last post: by
2 posts views Thread by BobAchgill | last post: by
10 posts views Thread by dba123 | last post: by
reply views Thread by =?Utf-8?B?R2lkaQ==?= | last post: by
reply views Thread by rosydwin | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.