OK, so I'm showing a big grid that's bound to a data set and then I'm attaching a new column for a checkbox for item selection - pretty common scenario I'd think. However I want the checkboxes to default to unchecked and for the life of me I can't get it to work. they show up as checked but "gray" and evaluate to null. You can check and uncheck them at which point they look "normal" and evaluate to true/false as you'd expect.
So is there a trick to the .DefaultCellValue = xxx that I'm missing here?
thanks
Thank you the InitializeTemplateAddRow worked just fine. I appreciate the help
Thanks
Hi Alex,
Why does the field default to N? That must be coming from the DataTable, the grid cannot be doing that. So you might try changing the default value on the DataTable column instead of in the grid.
Setting DefaultCellValue should work. What exactly do you mean when you say "it just won't let me?" How is it stopping you?
shyakaster said: protected void BeforeRowInsert(Infragistics.Win.UltraWinGrid.BeforeRowInsertEventArgs e) { //This does not help grdApprovalRoles.InitializeTemplateAddRow = DBNull.Value; }
protected void BeforeRowInsert(Infragistics.Win.UltraWinGrid.BeforeRowInsertEventArgs e)
{
//This does not help
grdApprovalRoles.InitializeTemplateAddRow = DBNull.Value;
}
The code you have here does not make sense and cannot possibly compile. InitializeTemplateAddRow is an event, you can't set an event to DBNull. If you want to use BeforeRowInsert, then you need to set the Value of the cell in the TemplateAddRow.
But you would be better off using the InitializeTemplateAddRow event and setting the Value of the appropriate cell inside that event.
When I click on a row in a grid another row is created below that and is populated with a DefaultCellValue of N which I have failed to change from the UltraGridDesigner so Ihave decided to change that from a BeforeRowInsert event below
How would I code this to make sure the row created below when I click on a row is null(not populated with any values). Please help am a novice.
Alex
Sorry I meant datatable and the DBNull angle is not working as well.It just wont let me
What exactly is a "table"? There is no such data type that I am aware of. Do you mean a DataTable?
In any case, why can't you set the DefaultCellValue to DBNull.Value? What's the problem?Are you getting an error?
Perhaps what you should do is handle the BeforeRowInsert event and set the value on the cell to DBNull.Value instead of using DefaultCellValue.