Right Click on Group Caption

Hi

Is it possible to right click on a Group Caption Control and then itterate through the items in that group 



is it possible to right click and perhaps update something in each of the 3 rows underneath programatically ? 

Peter



3 Replies 1 reply marked as answer

VS Vijayarasan Sivanandham Syncfusion Team June 14, 2021 02:07 PM UTC

Hi Peter,

Thank you for contacting Syncfusion Support.

Please find answer for your queries below 
Queries 
Solutions 
 
Is it possible to right click on a Group Caption Control and then itterate through the items in that group 

Your requirement can be achieved by using CellClick event in SfDataGrid. Please refer the below codes snippet, 
sfDataGrid.CellClick += SfDataGrid_CellClick;

private void SfDataGrid_CellClick(object sender, Syncfusion.WinForms.DataGrid.Events.CellClickEventArgs e) 
{ 
            //check Right Click on Group Caption in SfDataGrid 
            if (e.MouseEventArgs.Button == MouseButtons.Right && (e.DataRow.RowType == RowType.CaptionCoveredRow || e.DataRow.RowType == RowType.CaptionRow)) 
            { 
                //get the Grouped items 
                var groupRecords = (e.DataRow.RowData as Group).Records .ToList(); 
 
                //itterate items in that group  
                foreach (var record in groupRecords) 
                { 
                    //here customize based on your scenario                     
                } 
            } 
} 

For more information related to CellClick event, please refer the user guide documentation, 
 
 
 
is it possible to right click and perhaps update something in each of the 3 rows underneath programatically ?  
 
 
Your requirement can be achieved by customization the CellClick event in SfDataGrid.  
 
private void SfDataGrid_CellClick(object sender, Syncfusion.WinForms.DataGrid.Events.CellClickEventArgs e) 
{ 
            //check Right Click on Group Caption in SfDataGrid 
            if (e.MouseEventArgs.Button == MouseButtons.Right && (e.DataRow.RowType == RowType.CaptionCoveredRow || e.DataRow.RowType == RowType.CaptionRow)) 
            { 
                //get the Grouped items 
                var groupRecords = (e.DataRow.RowData as Group).Records .ToList(); 
 
                //itterate items in that group  
                foreach (var record in groupRecords) 
                { 
                    //here customize based on your scenario 
                    if (!record.IsRecords) 
                        return; 
 
                    //get the RowData of Grouped item one by one 
                    var data = (record as RecordEntry).Data; 
 
                    //set the value for particular cell in the row 
                    sfDataGrid.View.GetPropertyAccessProvider().SetValue(data, sfDataGrid.Columns[1].MappingName, "Modified Value"); 
                } 
            } 
} 

For more information related to Editing, please refer the user guide documentation, 
 

Sample Link: https://www.syncfusion.com/downloads/support/forum/166299/ze/Sample-1645933411

Please let us know if you have any concerns in this.

Regards,
Vijayarasan S 


Marked as answer

PE Peter June 14, 2021 02:42 PM UTC

Hi Vijayarasan,

Great Job

Thats working perfect

Regards

Peter


VS Vijayarasan Sivanandham Syncfusion Team June 15, 2021 05:55 AM UTC

Hi Peter, 
 
Thanks for the update. 
 
We are glad to know that the reported problem has been resolved at your end. Please let us know if you have any further queries on this. We are happy to help you😊. 
 
Regards, 
Vijayarasan S 


Loader.
Up arrow icon