I have an Infragistics WinGrid (UltraGrid, UltraWinGrid, whatever...) with an unbound column. It has Style = Checkbox
and DataType = System.Boolean
. I have set DefaultCellValue
to true
, but every开发者_运维技巧 new row appears with cell.Value == False
in that column. How can I get the default value to work? Thanks!
If all else fails I would suggest you revert to setting the value manually on the InitializeRow
event.
Try doing yourColumn.DataType = typeof(bool)
and yourColumn.DefaultCellValue = true
.
I see this is a old post, but this might help someone googling the answer!
On new rows, you can use the InitializeTemplateAddRow event, from there you can set the value of the desired column
//Add TemplateAddRow handler
_ultraGrid.InitializeTemplateAddRow += _ultraGrid_InitializeTemplateAddRow
//In the InitializeTemplateAddRow set the cells value
e.TemplateAddRow.Cells[CELLNAME].Value = true;
//OR
e.TemplateAddRow.Cells[index].Value = true;
When possible I like to use my own view model class when I bind to the grid and so when I encounter this problem I just add the needed column with a default of true.
If you cannot use your own view model class you can also handle the grid's Initialize event and set it there.
精彩评论