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. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Events Fired when the Records are Selected

Thread ID:

Created:

Updated:

Platform:

Replies:

141581 Dec 19,2018 06:17 AM UTC Dec 19,2018 11:22 AM UTC WinForms 1
loading
Tags: GridGroupingControl
Mariusz Juszkiewicz
Asked On December 19, 2018 06:17 AM UTC

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.

Arulraj A [Syncfusion]
Replied On 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 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon