How can I help you?
What are the Events Fired when the Records are Selected
7 Dec 20233 minutes to read
There are two type of selection architectures in a Grid Grouping control. One is designed specifically for Grid Grouping control referred as Record-Based Selection and the other is inherited from GridControlBase named as Model-Based Selection. Depending on the selection type, specific events are triggered:
Model Based Selection:
When you set the ListBoxSelectionMode property to None and the AllowSelection property to a value other than None in the GridGroupingControl, the model-based selection is used. The TableModel.SelectionChanging and TableModel.SelectionChanged events will trigger when using the model-based selection.
//Events subscription for Model based selection in GridGroupingControl
this.gridGroupingControl1.TableModel.SelectionChanging += OnSelectionChanging;
this.gridGroupingControl1.TableModel.SelectionChanged += OnSelectionChanged;
//Event customization
private void OnSelectionChanging(object sender, GridSelectionChangingEventArgs e)
{
//Here cutomize based on your scenario
Console.WriteLine("Event triggered for Model based selection");
}
//Event customization
private void OnSelectionChanged(object sender, GridSelectionChangedEventArgs e)
{
//Here cutomize based on your scenario
Console.WriteLine("Event triggered for Model based selection");
}'Events subscription for Model based selection in GridGroupingControl
AddHandler Me.gridGroupingControl1.TableModel.SelectionChanging, AddressOf OnSelectionChanging
AddHandler Me.gridGroupingControl1.TableModel.SelectionChanged, AddressOf OnSelectionChanged
'Event customization
Private Sub OnSelectionChanging(ByVal sender As Object, ByVal e As GridSelectionChangingEventArgs)
'Here cutomize based on your scenario
Console.WriteLine("Event triggered for Model based selection")
End Sub
'Event customization
Private Sub OnSelectionChanged(ByVal sender As Object, ByVal e As GridSelectionChangedEventArgs)
'Here cutomize based on your scenario
Console.WriteLine("Event triggered for Model based selection")
End SubRecord Based Selection:
When you set the ListBoxSelectionMode property to a value other than None and the AllowSelection property to None in the GridGroupingControl, a record-based selection is used. The SelectedRecordsChanging and SelectedRecordsChanged events are triggered when using the record-based selection.
//Events subscription for Record based selection in GridGroupingControl
this.gridGroupingControl1.SelectedRecordsChanging += OnSelectedRecordsChanging;
this.gridGroupingControl1.SelectedRecordsChanged += OnSelectedRecordsChanged;
//Event customization
private void OnSelectedRecordsChanging(object sender, SelectedRecordsChangedEventArgs e)
{
//Here cutomize based on your scenario
Console.WriteLine("Event triggered for Record based selection");
}
//Event customization
private void OnSelectedRecordsChanged(object sender, SelectedRecordsChangedEventArgs e)
{
//Here cutomize based on your scenario
Console.WriteLine("Event triggered for Record based selection");
}'Events subscription for Record based selection in GridGroupingControl
AddHandler Me.gridGroupingControl1.SelectedRecordsChanging, AddressOf OnSelectedRecordsChanging
AddHandler Me.gridGroupingControl1.SelectedRecordsChanged, AddressOf OnSelectedRecordsChanged
'Event customization
Private Sub OnSelectedRecordsChanging(ByVal sender As Object, ByVal e As SelectedRecordsChangedEventArgs)
'Here cutomize based on your scenario
Console.WriteLine("Event triggered for Record based selection")
End Sub
'Event customization
Private Sub OnSelectedRecordsChanged(ByVal sender As Object, ByVal e As SelectedRecordsChangedEventArgs)
'Here cutomize based on your scenario
Console.WriteLine("Event triggered for Record based selection")
End Sub