Hi,
I am adding a CheckBox column to my wingrid at runtime. How can I make it default to 'false' as opposed to the filled in square of 'null'? Right now I am looping through each cell and setting it to False. This is also marking the row as "edited". Does anyone know a better way? Here is my code so far:
Infragistics.Win.UltraWinGrid.UltraGridColumn completedColumn;
completedColumn.Style = Infragistics.Win.UltraWinGrid.ColumnStyle.CheckBox;
{
}
What, exactly, is the issue you are having?
The CheckBox in the cell reflects the value of the cell. So the way to "fix" this is to have the value of the cell (and therefore the value of the data source) return a valid value.
If your cell contains a null or DBNull, then that is not a valid true/false value. If you want the CheckBox to treat a null value as unchecked (as opposed to indeterminate), then you could use a DataFilter that converts null to false and vice versa. Is that what you want? If you do that, then the value of false will always be null in the data source. There's no way for a data filter to determine that the cell was originally null, but got translated to false by the datafilter. So either the cell would change the null to a false the first time it updated, or else you would always have to use null for false, instead of actually using false.
Hi, found this (old) post through Google.
Using infragistics 15.1, I'm having the same issue and am unable to work out a solution: There are multiple columns defined as Boolean? but the grid should display a checked or an unchecked checkbox, not tristate. Setting a default value on our generic datasource is not desirable.
In the initializelayout event of the grid, I tried forcing the style of all the affected columns to UltraWinGrid.ColumnStyle.CheckBox. No success.
I see that column.IsNullable is True, if I change column.Nullable to UltraWinGrid.Nullable.Disallow the value becomes false. However, the visual outcome remains the same.
Any suggestions?
Thankx Mike for your reply.
I had done the changes using a fake column in my datasource. That particular check boxcolumn is nothing but only show the data entry status to user. If the user save the grid data then checkbox will displayed as Checked, If user enter new row in Grid then checkbox show as Un-checked.
Thankx for your kind replay.
Hi Vijay,
No matter what event you use, the events will always fire. There is no way around that.
So you will either need to establish a default value for the field in your data source before binding to the grid.
Or, you could unhook the events or use the EventManager to disable those events and then loop though the rows.
I am just googling on Default value for CheckBox Column and found this post .
If I apply the same thing on InitializeRow event then It will fire the AfterRowUpdate, AfterCellUpdate and Other event.
I want the same thing without fire the AfterRowUpdate, AfterCellUpdate and other event on InitializeRow event.
Kindly suggest.
Vijay