Hi,
I'm using NetAdvantage 10.2. I have a grid where the first column is a column of checkboxes. All other columns need to be read-only. I have set the CellActivation for all columns to be NoEdit except for the checkbox column. I've overridden the CellClickAction to be RowSelect. I'm unable to check the checkboxes. I'm sure I'm either missing the setting of properties or not setting the right combination. What do I need to set to check the boxes in first column, yet leave the rest of the columns as read-only?
thank you
Mario
Hello Mario,
Thank you for contacting Infragistics.
When you use a CellClickAction of RowSelect, the clicks are never passed through to the cells, so the values of the checkboxes never get toggled. You'll need to set the CellClickAction property of the checkbox column to Edit.
Hi Dave,
I came to that same conclusion. The problem I have is that I want the rest of the columns to be read-only. Setting the AllowUpdate override to false on the grid doesn't work because I end up with the same issue. So I've looped through the columns setting CellClickAction for those columns to NoEdit. The issue I have now is when I click a cell on the "highlighted" row, the color changes from the highlight blue to an off white. Is there a way to stop that from happening or turn off the highlight of the row altogether?
Hi Mario,
I'm not sure what you mean. Which cell are you clicking on and what, exactly, is turning off-white?
I did a quick test with a simple grid with a checkbox column and some string columns. I was able to make the grid behave the way I think you want with just a few lines of code:
private void ultraGrid1_InitializeLayout(object sender, Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs e) { UltraGridLayout layout = e.Layout; UltraGridBand band = layout.Bands[0]; foreach (UltraGridColumn column in band.Columns) { // Column 0 is the checkbox column, so leave it alone. if (column.Key == "Column 0") continue; column.CellClickAction = CellClickAction.RowSelect; column.CellActivation = Activation.NoEdit; } }
Hi Mike,
I was missing the setting of the CellClickAction to RowSelect in the foreach as you showed in your example. I also found an initialization method where the Override.CellClickAction was being set to RowSelect on the grid, then later on when the grid was bound to the collection, the Override.CellClickAction was set to Edit. I removed those lines and it works as expected.
Hi mario,
I'm glad you got it working, but I am a little puzzled, because what you describe should actually work the same way. You can set CellClickAction on the Override and then just on the one checkbox column to override it and that would essentially be the same thing:
private void ultraGrid1_InitializeLayout(object sender, Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs e) { UltraGridLayout layout = e.Layout; UltraGridBand band = layout.Bands[0]; UltraGridOverride ov = layout.Override; ov.CellClickAction = CellClickAction.RowSelect; foreach (UltraGridColumn column in band.Columns) { // Column 0 is the checkbox column, so leave it alone. if (column.Key == "Column 0") { column.CellClickAction = CellClickAction.Edit; continue; } column.CellActivation = Activation.NoEdit; } }
The only way this code might NOT work, is if something else in your code is setting the CellActivation no the column and this override the Override setting.
I think the issue was the the CellClickAction.Edit was being set on the layout.Override and not on the checkbox column itself. So the grid was initialized with the CellClickAction.RowSelect, then when the grid datasource got set to the collection, the layout.Override.CellClickAction was set to "Edit" (not on the individual checkbox column itself). Then the code set the rest of the columns to Activation.NoEdit. When I clicked a cell, it was causing some strange side effects (i.e., the row was highlighted in the blue highlight, but the cell I clicked turned white while the rest of the row remained the blue highlight). I was trying to fix a bug written up by our testers and found that the grid wasn't set up properly.
Ah, okay, I think I see what was happening now. Yeah, it's a pretty common paradigm we use throughout the WinForms controls where you can set the same property at different levels and the more specific (Column in this case) setting overrides the less specific (Override in this case) setting.