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.
Unfortunately, activation email could not send to your email. Please try again.

Raise Row/Cell Click event

Thread ID:

Created:

Updated:

Platform:

Replies:

130844 Jun 7,2017 01:08 AM Jun 8,2017 09:37 AM Windows Forms 1
loading
Tags: GridGroupingControl
Tran Thanh Phong
Asked On June 7, 2017 01:08 AM

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

Arulpriya Ramalingam [Syncfusion]
Replied On June 8, 2017 09:37 AM

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 


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.

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.

;