1

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!

Joel in Gö
  • 7,460
  • 9
  • 47
  • 77

4 Answers4

2

If all else fails I would suggest you revert to setting the value manually on the InitializeRow event.

Mark Allanson
  • 1,368
  • 1
  • 10
  • 19
1

Try doing yourColumn.DataType = typeof(bool) and yourColumn.DefaultCellValue = true.

jjoelson
  • 5,771
  • 5
  • 31
  • 51
  • 2
    The DefaultCellValue applies to rows added via the add row feature and will not affect the rows from the data source. This is in the documentation here: http://help.infragistics.com/NetAdvantage/WinForms/Current/CLR2.0/?page=Infragistics2.Win.UltraWinGrid.v11.2~Infragistics.Win.UltraWinGrid.UltraGridColumn~DefaultCellValue.html – alhalama Mar 01 '12 at 01:44
0

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;
Samynix
  • 13
  • 6
0

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.

Mike Cheel
  • 12,626
  • 10
  • 72
  • 101