We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Events Fired when the Records are Selected

Does anyone know an example for
this.gridGroupingControl1.SelectedRecordsChanging and this.gridGroupingControl1.SelectedRecordsChanged

events.
How do you know what has been selected? Group bar? and how to retreive records in the events.

1 Reply

AA Arulraj A Syncfusion Team December 19, 2018 11:22 AM UTC

Hi Mariusz,  

Thanks for using Syncfusion product. 
  
The SelectedRecordsChanged and SelectedRecordsChanging events get fired only when the AllowSelection and ListBoxSelectionMode properties were set. To get the record details you can use the SelectedRecord property from the SelectedRecordsChanged event. To know the clicked cell type you can use TableControlCellClick event and get the TableCellType using its Style.
  
this.gridGroupingControl1.TableOptions.AllowSelection = Syncfusion.Windows.Forms.Grid.GridSelectionFlags.None; 
this.gridGroupingControl1.TableOptions.ListBoxSelectionMode = SelectionMode.MultiExtended; 


this.gridGroupingControl1.Table.SelectedRecordsChanged += Table_SelectedRecordsChanged; 
this.gridGroupingControl1.Table.SelectedRecordsChanging += Table_SelectedRecordsChanging; 
this.gridGroupingControl1.TableControlCellClick += GridGroupingControl1_TableControlCellClick; 
 
 
private void Table_SelectedRecordsChanging(object sender, Syncfusion.Grouping.SelectedRecordsChangedEventArgs e) 
{ 
Console.WriteLine(e.Action + ": Changing"); 
} 
 
void Table_SelectedRecordsChanged(object sender, Syncfusion.Grouping.SelectedRecordsChangedEventArgs e) 
{ 
 
Console.WriteLine(e.Action + ": Changed"); 
if (e.Action == SelectedRecordsChangedType.Added) 
{ 
    var selectedRecord = e.SelectedRecord.Record; 
} 
} 
 
private void GridGroupingControl1_TableControlCellClick(object sender, GridTableControlCellClickEventArgs e) 
{ 
GridTableCellStyleInfo style = e.TableControl.Model[e.Inner.RowIndex, e.Inner.ColIndex]; 
if (style.TableCellIdentity.TableCellType == GridTableCellType.GroupCaptionCell) 
{ 
    Console.WriteLine("GroupCaptionCell clicked"); 
} 
} 

 

Let us know whether this helps also if you need any further assistance on this. 

Regards, 
Arulraj A 


Loader.
Live Chat Icon For mobile
Up arrow icon