//To select many rows this.gridGroupingControl1.TableOptions.ListBoxSelectionMode = SelectionMode.MultiSimple; //Invoke the events to select the rows based on the checkbox value this.gridGroupingControl1.TableControlCheckBoxClick += new GridTableControlCellClickEventHandler(gridGroupingControl1_TableControlCheckBoxClick); this.gridGroupingControl1.TableControlCurrentCellKeyDown += gridGroupingControl1_TableControlCurrentCellKeyDown; //Event customization for selecting CheckBox by clicking void gridGroupingControl1_TableControlCheckBoxClick(object sender, GridTableControlCellClickEventArgs e) { GridTableCellStyleInfo style = (GridTableCellStyleInfo)e.TableControl.GetTableViewStyleInfo(e.Inner.RowIndex, e.Inner.ColIndex); Record currentRecord = style.TableCellIdentity.DisplayElement.GetRecord(); //To select the current Row currentRecord.SetSelected(style.Text == "False"); } //Event Customization for selecting CheckBox using SpaceBar void gridGroupingControl1_TableControlCurrentCellKeyDown(object sender, GridTableControlKeyEventArgs e) { GridStyleInfo style= e.TableControl.CurrentCell.Renderer.CurrentStyle; if(e.Inner.KeyCode== Keys.Space && style.CellType == GridCellTypeName.CheckBox ) { //Raise the checkbox click event while changing the checkbox value using the space bar e.TableControl.RaiseCheckBoxClick(e.TableControl.CurrentCell.RowIndex, e.TableControl.CurrentCell.ColIndex,MouseEventArgs.Empty as MouseEventArgs ); } } |