I am having below code that successfully adds a check box column to the ultrawingrid, my problem is that when I make a selection by checking a check box on the Select column the count of selected rows of ultrawingrid is not updated and it still shows the count as zero, and also I want to know how to enable multi checkbox selection i.e multiple rows selected...
Below is the code...
private void grdPayVis_InitializeLayout(object sender,InitializeLayoutEventArgs e)
var gridBand = grdPayVis.DisplayLayout.Bands[0];
if(!gridBand.Columns.Exists("Select"))
gridBand.Columns.Add("Select", "Select");
gridBand.Columns["Select"].Header.VisiblePosition = 0;
gridBand.Columns["Select"].Hidden = false;
gridBand.Columns["Select"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.CheckBox;
gridBand.Columns["Select"].AutoSizeMode = ColumnAutoSizeMode.AllRowsInBand;
gridBand.Columns["Select"].CellClickAction = CellClickAction.Edit;
}
I am not sure what you actually is trying to achieve. When you set CellClickAction in your Select column to Edit, and you click on any cell in this column the grid will select the cell and not the row. Grid has Selected property which exposes three collections - rows, columns and cells. In your case you are changing the selected cells and do not change the selected rows collection. If you need to select rows you need to set CellClickAction in your Select column to RowSelect. If you need in the same time to shange the checkbox state of the Select column you may handle AfterSelectChange event of the grid like this:
By default, the grid allows you to select many cells, rows or columns. However, when there is a cell in edit mode you cannot select any other cells. So again, as you have set CellClickAction to Edit when you click any cell in Select column it enters edit mode and no more cells could be selected before you exit edit mode.
You can add a new column to your datatable AFTER reading it from the database
Now the first table in your dataset has an unbound column named
Select
and when you set that as your datasource you will be able to manipulate as you have already done. But this time whenever you touch the checkbox the value True/False will be set in the underlying datatable. When you need to discover what are the checked rows you work with the datasource, not with the grid. For example