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

Raise Row/Cell Click event

How can I raise Row/Cell Click event in the grid grouping control programmatically?

1 Reply

AR Arulpriya Ramalingam Syncfusion Team June 8, 2017 01:37 PM UTC

Hi Tran, 
 
Thanks for your interest in Syncfusion products. 
 
In order to raise the TableControlCellClick event programmatically, the FakeLeftMouseClick() and ProcessTableClickCellsMouseDown() methods can be used. Please make use of below code and sample, 
 
Code snippet 
 
//To pass the cell range to perform the click event 
Rectangle rect = this.gridGroupingControl1.TableControl.RangeInfoToRectangle(GridRangeInfo.Cell(5,5)); 
int row, col; 
this.gridGroupingControl1.TableControl.PointToRowCol(rect.Location, out row, out col); 
//To get the current cell renderer 
GridTextBoxCellRenderer ren = this.gridGroupingControl1.TableControl.GetCellRenderer(row, col) as GridTextBoxCellRenderer; 
 
//Hooking the cell click event programmaticlly 
Syncfusion.Drawing.ActiveXSnapshot.FakeLeftMouseClick(gridGroupingControl1.TableControl, new System.Drawing.Point(rect.X, rect.Y)); 
this.gridGroupingControl1.TableControl.ProcessTableClickCellsMouseDown(new GridTableClickCellsEventArgs(gridGroupingControl1.TableControl, ren, new MouseEventArgs(MouseButtons.Left, 1, rect.X, rect.Y, 0))); 
//Event triggering 
this.gridGroupingControl1.TableControlCellClick += GridGroupingControl1_TableControlCellClick; 
 
 
//Event customization 
private void GridGroupingControl1_TableControlCellClick(object sender, GridTableControlCellClickEventArgs e) 
{ 
    MessageBox.Show(e.Inner.ColIndex.ToString()); 
} 
 
 
Arulpriya 


Loader.
Live Chat Icon For mobile
Up arrow icon